pr cleanup

config consolidation
This commit is contained in:
jay brown
2025-04-17 15:59:14 -07:00
parent c229fb5a13
commit 55c569baeb
3 changed files with 40 additions and 82 deletions
+6 -7
View File
@@ -94,9 +94,9 @@ func main() {
return swagger, nil
}
// Both of these operations (InitializeConfig and InitializeAuthProvider)
// would be better off in the service.new but there are code dependencies
// that make this not possible right now without significant refactoring.
// Both of these operations (InitializeConfig and InitializeAuthConfig)
// would be better off in one function but since there are services
// that need the config but do not use auth we will keep them separate for now.
// This must be done before the rbac.InitializeAuthProvider
errInitializingConfig := serviceconfig.InitializeConfig(cfg)
@@ -106,10 +106,9 @@ func main() {
}
// Authentication specific config.
// This may move to another function after refactoring is done.
// replace the path here with value from ENV
baseUrl := "http://localhost:8080"
errorInitializingAuthConfig := cfg.InitializeAuthConfig(baseUrl, cfg.GetLogger())
cfg.BaseURL = fmt.Sprintf("%s:%d", cfg.BaseURL, cfg.Port)
errorInitializingAuthConfig := cfg.InitializeAuthConfig(cfg.BaseURL, cfg.GetLogger())
fmt.Printf("base url after InitializeAuthConfig: %s\n", cfg.BaseURL)
// join initErr with errorInitializingAuthConfig
if errorInitializingAuthConfig != nil {
slog.Error(errorInitializingAuthConfig.Error())