mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
s3: Fix shared_credentials_file auth
S3 backend shared_credentials_file option wasn't working neither from config option nor from command line option. This was caused cause shared_credentials_file_provider works as part of chain provider, but in case user haven't specified access_token and access_key we had removed (set nil) to credentials field, that may contain actual credentials got from ChainProvider. AWS_SHARED_CREDENTIALS_FILE env varible as far as i understood worked, cause aws_sdk code handles it as one of default auth options, when there's not configured credentials.
This commit is contained in:
parent
cd6fd4be4b
commit
1605f9e14d
|
@ -1559,9 +1559,6 @@ func s3Connection(ctx context.Context, opt *Options) (*s3.S3, *session.Session,
|
|||
if opt.EnvAuth && opt.AccessKeyID == "" && opt.SecretAccessKey == "" {
|
||||
// Enable loading config options from ~/.aws/config (selected by AWS_PROFILE env)
|
||||
awsSessionOpts.SharedConfigState = session.SharedConfigEnable
|
||||
// The session constructor (aws/session/mergeConfigSrcs) will only use the user's preferred credential source
|
||||
// (from the shared config file) if the passed-in Options.Config.Credentials is nil.
|
||||
awsSessionOpts.Config.Credentials = nil
|
||||
}
|
||||
ses, err := session.NewSessionWithOptions(awsSessionOpts)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user