Skip to content

Commit

Permalink
fix: config
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jan 16, 2024
1 parent fb05690 commit 584dea7
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions cfgldr/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,11 @@ type Config struct {
}

func LoadConfig() (*Config, error) {
dbCfgLdr := viper.New()
dbCfgLdr.SetEnvPrefix("DB")
dbCfgLdr.AutomaticEnv()
dbCfgLdr.AllowEmptyEnv(false)
dbConfig := Database{}
if err := dbCfgLdr.Unmarshal(&dbConfig); err != nil {
return nil, err
}
LoadEnvGroup(&dbConfig, "DB")

appCfgLdr := viper.New()
appCfgLdr.SetEnvPrefix("APP")
appCfgLdr.AutomaticEnv()
dbCfgLdr.AllowEmptyEnv(false)
appConfig := App{}
if err := appCfgLdr.Unmarshal(&appConfig); err != nil {
return nil, err
}
LoadEnvGroup(&appConfig, "APP")

jwtConfig := &Jwt{}
LoadEnvGroup(jwtConfig, "JWT")
Expand Down

0 comments on commit 584dea7

Please sign in to comment.