fix: capitalize and add config tags to env and loglevel fields
This commit is contained in:
parent
313bc7f9bb
commit
e7079e9892
1 changed files with 3 additions and 3 deletions
6
main.go
6
main.go
|
@ -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()
|
||||||
|
|
Loading…
Add table
Reference in a new issue