fix: add yaml tags to OAuth config struct for proper parsing
This commit is contained in:
parent
540c69d7d6
commit
0299e2891c
1 changed files with 9 additions and 8 deletions
17
main.go
17
main.go
|
@ -26,11 +26,11 @@ var staticFiles embed.FS
|
||||||
var sqliteMigrations embed.FS
|
var sqliteMigrations embed.FS
|
||||||
|
|
||||||
type OAuthConfig struct {
|
type OAuthConfig struct {
|
||||||
ClientID string `config:"client_id"`
|
ClientID string `config:"client_id" yaml:"client_id"`
|
||||||
ClientSecret string `config:"client_secret"`
|
ClientSecret string `config:"client_secret" yaml:"client_secret"`
|
||||||
AuthURL string `config:"auth_url"`
|
AuthURL string `config:"auth_url" yaml:"auth_url"`
|
||||||
TokenURL string `config:"token_url"`
|
TokenURL string `config:"token_url" yaml:"token_url"`
|
||||||
UserInfoURL string `config:"userinfo_url"`
|
UserInfoURL string `config:"userinfo_url" yaml:"userinfo_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DBConfig struct {
|
type DBConfig struct {
|
||||||
|
@ -48,7 +48,7 @@ type Config struct {
|
||||||
Server struct {
|
Server struct {
|
||||||
Port int `config:"port"`
|
Port int `config:"port"`
|
||||||
} `config:"server"`
|
} `config:"server"`
|
||||||
OAuth OAuthConfig `config:"oauth"`
|
OAuth OAuthConfig `config:"oauth" yaml:"oauth"`
|
||||||
DB DBConfig `config:"db"`
|
DB DBConfig `config:"db"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ var db *sql.DB
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Use the global cfg variable instead of declaring a new one
|
// Use the global cfg variable instead of declaring a new one
|
||||||
cfgReader := config.NewConfReader("config")
|
cfgReader := config.NewConfReader("config").WithSearchDirs("./", ".", "../", "../../")
|
||||||
cfgErr := cfgReader.Read(&cfg)
|
cfgErr := cfgReader.Read(&cfg)
|
||||||
|
|
||||||
zapcfg := zap.NewProductionConfig()
|
zapcfg := zap.NewProductionConfig()
|
||||||
|
@ -79,7 +79,8 @@ func main() {
|
||||||
logger.Fatal("Failed to load config", zap.Error(cfgErr))
|
logger.Fatal("Failed to load config", zap.Error(cfgErr))
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Debug("Loaded config", zap.Any("config", cfg))
|
// Print the raw config to see what's actually loaded
|
||||||
|
logger.Info("Raw config loaded", zap.Any("config", cfg))
|
||||||
|
|
||||||
// Add detailed logging of the OAuth config
|
// Add detailed logging of the OAuth config
|
||||||
logger.Info("OAuth Configuration",
|
logger.Info("OAuth Configuration",
|
||||||
|
|
Loading…
Add table
Reference in a new issue