summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-22 09:07:47 +0300
committerPaul Buetow <paul@buetow.org>2026-04-22 09:07:47 +0300
commit519be7e7dd12cbe3c85f90cf06d65b377eb22a3c (patch)
tree59bc012999bd03a26e5fa6c097741ede7b211296 /internal/config/config.go
parent24dd98eaa9759884b17f18c729d498af6ec70e9e (diff)
add logo
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index f778637..754c816 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -197,6 +197,7 @@ func Load(configPath string) (*Config, error) {
return nil, fmt.Errorf("decode config: %w", err)
}
+ applyEnvFallbacks(cfg)
cfg.normalize()
if err := cfg.validate(); err != nil {
return nil, err
@@ -393,3 +394,12 @@ func setDefaults(v *viper.Viper, cfg *Config) {
v.SetDefault("prompts_dir", cfg.PromptsDir)
}
+
+func applyEnvFallbacks(cfg *Config) {
+ if cfg == nil {
+ return
+ }
+ if cfg.API.GoogleAPIKey == "" {
+ cfg.API.GoogleAPIKey = os.Getenv("GOOGLE_API_KEY")
+ }
+}