Skip to content

Commit

Permalink
load default namespace at initialisation
Browse files Browse the repository at this point in the history
Signed-off-by: Enrique Lacal <[email protected]>
  • Loading branch information
EnriqueL8 committed Jul 9, 2024
1 parent 2fef8f0 commit 46cf5cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type apiServer struct {
ffiSwaggerGen FFISwaggerGen
apiPublicURL string
dynamicPublicURLHeader string
defaultNamespace string
}

func InitConfig() {
Expand All @@ -76,6 +77,7 @@ func NewAPIServer() Server {
apiTimeout: config.GetDuration(coreconfig.APIRequestTimeout),
apiMaxTimeout: config.GetDuration(coreconfig.APIRequestMaxTimeout),
dynamicPublicURLHeader: config.GetString(coreconfig.APIDynamicPublicURLHeader),
defaultNamespace: config.GetString(coreconfig.NamespacesDefault),
metricsEnabled: config.GetBool(coreconfig.MetricsEnabled),
ffiSwaggerGen: &ffiSwaggerGen{},
}
Expand Down Expand Up @@ -188,9 +190,9 @@ func (as *apiServer) getBaseURL(req *http.Request) string {
vars := mux.Vars(req)
if ns, ok := vars["ns"]; ok && ns != "" {
baseURL += `/namespaces/` + ns
} else if ns := config.GetString(coreconfig.NamespacesDefault); ns != "" {
} else {
// Use the default namespace
baseURL += `/namespaces/` + ns
baseURL += `/namespaces/` + as.defaultNamespace
}

return baseURL
Expand Down

0 comments on commit 46cf5cd

Please sign in to comment.