From c39703ed0d7c5efc6237e7a5b1552875f0ad7d69 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Thu, 2 Jul 2026 22:09:09 +1000 Subject: [PATCH] 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: https://git.unkin.net/unkin/artifactapi/pulls/85 Co-authored-by: Ben Vincent Co-committed-by: Ben Vincent --- internal/config/env.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/config/env.go b/internal/config/env.go index 633beba..6d33d2a 100644 --- a/internal/config/env.go +++ b/internal/config/env.go @@ -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