From 31b429e9f76f535821af12b043b05dc87d3dfb81 Mon Sep 17 00:00:00 2001 From: Joel Eng Date: Sat, 1 Nov 2025 12:12:59 -0500 Subject: [PATCH] fix: honor --profile flag for AWS credential and config loading - Allow --profile to use AWS credential chain instead of forcing ~/.aws/credentials - Add Profile field to session.Options for proper shared config loading - Maintains backward compatibility for --credentials-file usage Resolves issue where --profile flag was ignored and application always used default profile from shared config. --- storage/s3.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/s3.go b/storage/s3.go index 3313be66e..b61c00dea 100644 --- a/storage/s3.go +++ b/storage/s3.go @@ -1242,7 +1242,7 @@ func (sc *SessionCache) newSession(ctx context.Context, opts Options) (*session. if opts.NoSignRequest { // do not sign requests when making service API calls awsCfg = awsCfg.WithCredentials(credentials.AnonymousCredentials) - } else if opts.CredentialFile != "" || opts.Profile != "" { + } else if opts.CredentialFile != "" { awsCfg = awsCfg.WithCredentials( credentials.NewSharedCredentials(opts.CredentialFile, opts.Profile), ) @@ -1304,6 +1304,7 @@ func (sc *SessionCache) newSession(ctx context.Context, opts Options) (*session. session.Options{ Config: *awsCfg, SharedConfigState: useSharedConfig, + Profile: opts.Profile, }, ) if err != nil {