Skip to content

Commit 1b562b0

Browse files
backend: cmd: Extract logStartupInfo from createHeadlampHandler
Co-authored-by: René Dudfield <[email protected]>
1 parent f0baed3 commit 1b562b0

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

backend/cmd/headlamp.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,7 @@ func createHeadlampHandler(config *HeadlampConfig) http.Handler {
406406

407407
config.StaticPluginDir = os.Getenv("HEADLAMP_STATIC_PLUGINS_DIR")
408408

409-
logger.Log(logger.LevelInfo, nil, nil, "Creating Headlamp handler")
410-
logger.Log(logger.LevelInfo, nil, nil, "Listen address: "+fmt.Sprintf("%s:%d", config.ListenAddr, config.Port))
411-
logger.Log(logger.LevelInfo, nil, nil, "Kubeconfig path: "+kubeConfigPath)
412-
logger.Log(logger.LevelInfo, nil, nil, "Static plugin dir: "+config.StaticPluginDir)
413-
logger.Log(logger.LevelInfo, nil, nil, "Plugins dir: "+config.PluginDir)
414-
logger.Log(logger.LevelInfo, nil, nil, "Dynamic clusters support: "+fmt.Sprint(config.EnableDynamicClusters))
415-
logger.Log(logger.LevelInfo, nil, nil, "Helm support: "+fmt.Sprint(config.EnableHelm))
416-
logger.Log(logger.LevelInfo, nil, nil, "Proxy URLs: "+fmt.Sprint(config.ProxyURLs))
409+
logStartupInfo(config);
417410

418411
plugins.PopulatePluginsCache(config.StaticPluginDir, config.PluginDir, config.cache)
419412

@@ -838,6 +831,18 @@ func createHeadlampHandler(config *HeadlampConfig) http.Handler {
838831
return r
839832
}
840833

834+
// logStartupInfo logs config information of the Headlamp server.
835+
func logStartupInfo(config *HeadlampConfig) {
836+
logger.Log(logger.LevelInfo, nil, nil, "Creating Headlamp handler")
837+
logger.Log(logger.LevelInfo, nil, nil, "Listen address: "+fmt.Sprintf("%s:%d", config.ListenAddr, config.Port))
838+
logger.Log(logger.LevelInfo, nil, nil, "Kubeconfig path: "+config.KubeConfigPath)
839+
logger.Log(logger.LevelInfo, nil, nil, "Static plugin dir: "+config.StaticPluginDir)
840+
logger.Log(logger.LevelInfo, nil, nil, "Plugins dir: "+config.PluginDir)
841+
logger.Log(logger.LevelInfo, nil, nil, "Dynamic clusters support: "+fmt.Sprint(config.EnableDynamicClusters))
842+
logger.Log(logger.LevelInfo, nil, nil, "Helm support: "+fmt.Sprint(config.EnableHelm))
843+
logger.Log(logger.LevelInfo, nil, nil, "Proxy URLs: "+fmt.Sprint(config.ProxyURLs))
844+
}
845+
841846
func parseClusterAndToken(r *http.Request) (string, string) {
842847
cluster := ""
843848
re := regexp.MustCompile(`^/clusters/([^/]+)/.*`)

0 commit comments

Comments
 (0)