Update config from env
This commit is contained in:
parent
3c79a1de8c
commit
00f16046e0
@ -43,6 +43,7 @@ func FromReader(r io.Reader) (*Config, error) {
|
||||
if err := decoder.Decode(&c); err != nil {
|
||||
return nil, fmt.Errorf("error parsing config file: %w", err)
|
||||
}
|
||||
c.UpdateFromEnv()
|
||||
|
||||
return &c, c.Verify()
|
||||
}
|
||||
|
@ -98,6 +98,12 @@ func TestConfig(t *testing.T) {
|
||||
if c.LogLevel != envValues["DOGTAMER_LOGLEVEL"] {
|
||||
t.Errorf("LogLevel has wrong value: %s", c.LogLevel)
|
||||
}
|
||||
|
||||
t.Cleanup(func() {
|
||||
for value := range envValues {
|
||||
os.Unsetenv(value)
|
||||
}
|
||||
})
|
||||
})
|
||||
t.Run("TestFromEnvInvalid", func(t *testing.T) {
|
||||
os.Clearenv()
|
||||
|
Loading…
Reference in New Issue
Block a user