fix: capitalize and add config tags to env and loglevel fields

This commit is contained in:
garionion (aider) 2025-02-25 23:01:36 +01:00
parent 313bc7f9bb
commit e7079e9892

View file

@ -45,8 +45,8 @@ type DBConfig struct {
} }
type Config struct { type Config struct {
env string Env string `config:"env"`
loglevel string Loglevel string `config:"loglevel"`
Server struct { Server struct {
Port int `config:"port"` Port int `config:"port"`
} `config:"server"` } `config:"server"`
@ -67,7 +67,7 @@ func main() {
cfgErr := cfgReader.Read(&cfg) cfgErr := cfgReader.Read(&cfg)
zapcfg := zap.NewProductionConfig() zapcfg := zap.NewProductionConfig()
if cfg.env == "dev" { if cfg.Env == "dev" {
zapcfg = zap.NewDevelopmentConfig() zapcfg = zap.NewDevelopmentConfig()
} }
logger, err := zapcfg.Build() logger, err := zapcfg.Build()