fix: check --env flags when validating API keys during deploy#292
Merged
inFocus7 merged 5 commits intoagentregistry-dev:mainfrom Mar 11, 2026
Merged
Conversation
inFocus7
reviewed
Mar 9, 2026
Collaborator
inFocus7
left a comment
There was a problem hiding this comment.
manually validated (just small test that it works), unit tests are good for sanity too, just had very minor nitpicks
…gentregistry-dev#151) `arctl agent deploy --env GOOGLE_API_KEY=somekey` now correctly uses the provided key instead of failing with "required API key not set". The --env flag values are checked before falling back to OS environment variables, and all --env entries are included in the deployment config. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Fabian Gonzalez <[email protected]>
Signed-off-by: Fabian Gonzalez <[email protected]>
|
You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks! |
peterj
reviewed
Mar 11, 2026
internal/cli/agent/deploy.go
Outdated
|
|
||
| // Parse --env flags into a map | ||
| envMap := make(map[string]string) | ||
| for _, e := range envFlags { |
Contributor
There was a problem hiding this comment.
@inFocus7 there's a parseEnvFlags in agent/run.go -- would it make sense to pull that out into some util/common file and then re-use it here too?
Collaborator
There was a problem hiding this comment.
Yeah that makes sense. I moved it to a new internal/cli/utils/utils.go file, since this is specific for cli usage. If we think it'll be used elsewhere, i can move it to the pre-existing general internal/utils/utils.go pkg.
Signed-off-by: Fabian Gonzalez <[email protected]>
peterj
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
--env/-eflag toarctl agent deployfor passing environment variables (KEY=VALUE)validateAPIKey()now checks--envvalues before falling back to OS environmentbuildDeployConfig()includes all--enventries in the deployment config, with flag values taking precedence over OS envarctl agent deploy myagent --env GOOGLE_API_KEY=somekeyfailed with "required API key not set"--env/-eflag toarctl agent runfor passing environment variables (KEY=VALUE) (for command consistency)agent runtests to verify behavior.Fixes #151
Validation Steps
Test plan
TestValidateAPIKey_WithExtraEnv(6 cases): extra env, OS env, missing, precedence, nil fallback, unknown providerTestBuildDeployConfig_WithEnvOverrides(5 cases): override inclusion, precedence, OS fallback, telemetry, absent keys🤖 Generated with Claude Code