refactor: simplify config reader and improve logging
This commit is contained in:
parent
364a27e44f
commit
540c69d7d6
1 changed files with 5 additions and 3 deletions
8
main.go
8
main.go
|
@ -62,7 +62,7 @@ var db *sql.DB
|
|||
|
||||
func main() {
|
||||
// Use the global cfg variable instead of declaring a new one
|
||||
cfgReader := config.NewConfReader("config").WithSearchDirs("./", ".")
|
||||
cfgReader := config.NewConfReader("config")
|
||||
cfgErr := cfgReader.Read(&cfg)
|
||||
|
||||
zapcfg := zap.NewProductionConfig()
|
||||
|
@ -79,8 +79,10 @@ func main() {
|
|||
logger.Fatal("Failed to load config", zap.Error(cfgErr))
|
||||
}
|
||||
|
||||
logger.Debug("Loaded config", zap.Any("config", cfg))
|
||||
|
||||
// Add detailed logging of the OAuth config
|
||||
logger.Info("OAuth Configuration",
|
||||
logger.Info("OAuth Configuration",
|
||||
zap.String("ClientID", cfg.OAuth.ClientID),
|
||||
zap.String("ClientSecret", cfg.OAuth.ClientSecret),
|
||||
zap.String("AuthURL", cfg.OAuth.AuthURL),
|
||||
|
@ -98,7 +100,7 @@ func main() {
|
|||
RedirectURL: fmt.Sprintf("http://localhost:%d/oauth/callback", cfg.Server.Port),
|
||||
Scopes: []string{"profile", "email"},
|
||||
}
|
||||
|
||||
|
||||
// Log the OAuth config that's actually being used
|
||||
logger.Info("Initialized OAuth Config",
|
||||
zap.String("ClientID", oauthConfig.ClientID),
|
||||
|
|
Loading…
Add table
Reference in a new issue