Skip to content

fix: resolve provider env vars not being applied (#66)#270

Open
boengai wants to merge 2 commits intosipeed:mainfrom
boengai:fix/provider-env-vars-issue-66
Open

fix: resolve provider env vars not being applied (#66)#270
boengai wants to merge 2 commits intosipeed:mainfrom
boengai:fix/provider-env-vars-issue-66

Conversation

@boengai
Copy link

@boengai boengai commented Feb 16, 2026

Summary

  • Fix PICOCLAW_PROVIDERS_* env vars not applied because {{.Name}} is unsupported by caarlos0/env #66: PICOCLAW_PROVIDERS_* env vars (e.g. PICOCLAW_PROVIDERS_ANTHROPIC_API_KEY) were not being read because caarlos0/env does not support {{.Name}} template syntax in env tags
  • Replace broken template tags with envPrefix on each provider field in ProvidersConfig, which correctly prepends the provider name to each env key
  • Add test verifying env vars are properly parsed for multiple providers

Test plan

  • go fmt — no formatting changes needed
  • go vet ./... — no issues
  • go test ./... — all packages pass
  • New TestProviderConfig_EnvVars test confirms env vars like PICOCLAW_PROVIDERS_ANTHROPIC_API_KEY are correctly read

🤖 Generated with Claude Code

Replace unsupported {{.Name}} template syntax in ProviderConfig env tags
with envPrefix on each provider field in ProvidersConfig, so that
environment variables like PICOCLAW_PROVIDERS_ANTHROPIC_API_KEY are
correctly parsed by caarlos0/env.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrbeandev
Copy link

Great fix for those env-var tags! This correction is essential for anyone running without a static config. In PR #239, I've implemented a related dynamic provider discovery system using reflection that relies on these exact fields. Your fix will help ensure those providers are detected correctly. Looking forward to getting these consistent!

Keep both TestProviderConfig_EnvVars (from sipeed#66) and
TestSaveConfig_FilePermissions (from sipeed#186).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Leeaandrob
Copy link
Collaborator

@Zepan Fixes provider environment variables not being applied when config.json exists — this means OPENAI_API_KEY env var gets ignored if you have a config file. Real usability bug.

Recommendation: Merge. +46/-18, fixes a configuration precedence issue that affects Docker/container deployments where env vars are the standard config mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PICOCLAW_PROVIDERS_* env vars not applied because {{.Name}} is unsupported by caarlos0/env

3 participants