Skip to content

Commit 55bdf7c

Browse files
backend: Add setupStaticFiles function
Signed-off-by: SinghaAnirban005 <[email protected]>
1 parent a614ab7 commit 55bdf7c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

backend/cmd/headlamp.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,22 @@ func setupInClusterContext(config *HeadlampConfig) {
444444
}
445445
}
446446

447+
func setupStaticFiles(config *HeadlampConfig) {
448+
if config.StaticDir != "" {
449+
baseURLReplace(config.StaticDir, config.BaseURL)
450+
}
451+
}
452+
453+
func createRouter(config *HeadlampConfig) *mux.Router {
454+
if config.BaseURL == "" {
455+
return mux.NewRouter()
456+
}
457+
458+
baseRoute := mux.NewRouter()
459+
460+
return baseRoute.PathPrefix(config.BaseURL).Subrouter()
461+
}
462+
447463
func parseClusterAndToken(r *http.Request) (string, string) {
448464
cluster := ""
449465
re := regexp.MustCompile(`^/clusters/([^/]+)/.*`)

0 commit comments

Comments
 (0)