chore(env): getEnvWithRetro helper function

This commit is contained in:
Quentin McGaw
2022-01-29 14:55:56 +00:00
parent e7e4cfca4c
commit 0d8cb66d43
13 changed files with 113 additions and 300 deletions

View File

@@ -30,15 +30,9 @@ func (r *Reader) ReadHealth() (health settings.Health, err error) {
}
func (r *Reader) readDurationWithRetro(envKey, retroEnvKey string) (d *time.Duration, err error) {
s := os.Getenv(retroEnvKey)
envKey, s := r.getEnvWithRetro(envKey, retroEnvKey)
if s == "" {
s = os.Getenv(envKey)
if s == "" {
return nil, nil //nolint:nilnil
}
} else {
r.onRetroActive(envKey, retroEnvKey)
envKey = retroEnvKey
return nil, nil //nolint:nilnil
}
d = new(time.Duration)