diff --git a/config/config.go b/config/config.go index 9b1fcbd..cc04f35 100644 --- a/config/config.go +++ b/config/config.go @@ -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() } diff --git a/config/config_test.go b/config/config_test.go index 2ddd9d0..bbe5e7a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -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()