Skip to content

fix: registry commands respect AWS_CONFIG_FILE#927

Open
yuriipolishchuk wants to merge 1 commit intofwdcloudsec:mainfrom
yuriipolishchuk:fix/registry-respect-aws-config-file
Open

fix: registry commands respect AWS_CONFIG_FILE#927
yuriipolishchuk wants to merge 1 commit intofwdcloudsec:mainfrom
yuriipolishchuk:fix/registry-respect-aws-config-file

Conversation

@yuriipolishchuk
Copy link

@yuriipolishchuk yuriipolishchuk commented Mar 9, 2026

Fixes #926

Registry commands (add, sync, remove, setup) ignored AWS_CONFIG_FILE and always used ~/.aws/config. This was fixed for assume in #229 but missed for registry.

The fix reuses cfaws.GetAWSConfigPath() — the same function already used by assume, granted sso, and granted credentials to resolve the config path.

Added tests for both custom and default paths.

granted registry add/sync/remove/setup ignored the AWS_CONFIG_FILE
environment variable and always wrote to ~/.aws/config. The assume
command was fixed for this in fwdcloudsec#229, but registry commands were missed.

This change reuses cfaws.GetAWSConfigPath() which already handles
AWS_CONFIG_FILE correctly, consistent with AWS CLI behavior:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
Copy link
Collaborator

@meyerjrr meyerjrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Just have one minor nitpick


configPath := filepath.Join(h, ".aws", "config")
return configPath, nil
return cfaws.GetAWSConfigPath(), nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of returning cfaws.GetAWSConfigPath() here can we update the uses of getDefaultAWSConfigLocation in the registry to instead just call cfaws.GetAWSConfigPath() for consistency across the codebase?

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.

Registry commands ignore AWS_CONFIG_FILE environment variable

2 participants