diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-19 23:28:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-19 23:28:03 +0300 |
| commit | 507b84f2442eecf7422738b66dc29417870cda52 (patch) | |
| tree | 4daa19839a4cf237f1eb3254889dd20246519180 /internal/appconfig | |
| parent | fd8e2fe8177305c9271d12c90cc6ad2ed73a1673 (diff) | |
config: apply HEXAI_* env even without config file; docs: clarify Copilot key; prefer HEXAI_COPILOT_API_KEY in builders
Diffstat (limited to 'internal/appconfig')
| -rw-r--r-- | internal/appconfig/config.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go index 58bcc3a..6d95da2 100644 --- a/internal/appconfig/config.go +++ b/internal/appconfig/config.go @@ -66,18 +66,18 @@ func Load(logger *log.Logger) App { return cfg // Return defaults if no logger is provided (e.g. in tests) } - configPath, err := getConfigPath() - if err != nil { - logger.Printf("%v", err) - return cfg - } - - fileCfg, err := loadFromFile(configPath, logger) - if err != nil { - return cfg - } + configPath, err := getConfigPath() + if err != nil { + logger.Printf("%v", err) + // Even if config path cannot be resolved, still allow env overrides below. + } else { + if fileCfg, err := loadFromFile(configPath, logger); err == nil && fileCfg != nil { + cfg.mergeWith(fileCfg) + } + // When the config file is missing or invalid, we keep defaults and still + // apply any environment overrides below. + } - cfg.mergeWith(fileCfg) // Environment overrides (take precedence over file) if envCfg := loadFromEnv(logger); envCfg != nil { cfg.mergeWith(envCfg) |
