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

@@ -35,17 +35,7 @@ var ErrSystemIDNotValid = errors.New("system ID is not valid")
func (r *Reader) readID(key, retroKey string) (
id *uint16, err error) {
idEnvKey := key
idString := os.Getenv(key)
if idString == "" {
// retro-compatibility
idString = os.Getenv(retroKey)
if idString != "" {
idEnvKey = retroKey
r.onRetroActive(retroKey, key)
}
}
idEnvKey, idString := r.getEnvWithRetro(key, retroKey)
if idString == "" {
return nil, nil //nolint:nilnil
}