fix: getenv treats an explicitly-empty value as unset (#85)
Fixes #69 ## Why `getenv` returned the fallback whenever `os.Getenv` was empty, so an intentionally-empty env var could not override a non-empty default. ## Changes - Use `os.LookupEnv` to distinguish unset from set-but-empty. ## Validation - `make e2e` passes. Reviewed-on: #85 Co-authored-by: Ben Vincent <ben@unkin.net> Co-committed-by: Ben Vincent <ben@unkin.net>
This commit was merged in pull request #85.
This commit is contained in:
@@ -65,7 +65,7 @@ func Load() (*Config, error) {
|
||||
}
|
||||
|
||||
func getenv(key, fallback string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
if v, ok := os.LookupEnv(key); ok {
|
||||
return v
|
||||
}
|
||||
return fallback
|
||||
|
||||
Reference in New Issue
Block a user