forked from TrueCloudLab/rclone
s3: implement profile
and shared_credentials_file
options
It is impossible to use two different profiles at the same time - these config vars enable that. See: https://forum.rclone.org/t/s3-source-destination-named-profile/17417
This commit is contained in:
parent
957311f479
commit
2288a5c617
1 changed files with 31 additions and 1 deletions
|
@ -853,6 +853,31 @@ for data integrity checking but can cause long delays for large files
|
||||||
to start uploading.`,
|
to start uploading.`,
|
||||||
Default: false,
|
Default: false,
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
|
}, {
|
||||||
|
Name: "shared_credentials_file",
|
||||||
|
Help: `Path to the shared credentials file
|
||||||
|
|
||||||
|
If env_auth = true then rclone can use a shared credentials file.
|
||||||
|
|
||||||
|
If this variable is empty rclone will look for the
|
||||||
|
"AWS_SHARED_CREDENTIALS_FILE" env variable. If the env value is empty
|
||||||
|
it will default to the current user's home directory.
|
||||||
|
|
||||||
|
Linux/OSX: "$HOME/.aws/credentials"
|
||||||
|
Windows: "%USERPROFILE%\.aws\credentials"
|
||||||
|
`,
|
||||||
|
Advanced: true,
|
||||||
|
}, {
|
||||||
|
Name: "profile",
|
||||||
|
Help: `Profile to use in the shared credentials file
|
||||||
|
|
||||||
|
If env_auth = true then rclone can use a shared credentials file. This
|
||||||
|
variable controls which profile is used in that file.
|
||||||
|
|
||||||
|
If empty it will default to the environment variable "AWS_PROFILE" or
|
||||||
|
"default" if that environment variable is also not set.
|
||||||
|
`,
|
||||||
|
Advanced: true,
|
||||||
}, {
|
}, {
|
||||||
Name: "session_token",
|
Name: "session_token",
|
||||||
Help: "An AWS session token",
|
Help: "An AWS session token",
|
||||||
|
@ -1003,6 +1028,8 @@ type Options struct {
|
||||||
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
||||||
MaxUploadParts int64 `config:"max_upload_parts"`
|
MaxUploadParts int64 `config:"max_upload_parts"`
|
||||||
DisableChecksum bool `config:"disable_checksum"`
|
DisableChecksum bool `config:"disable_checksum"`
|
||||||
|
SharedCredentialsFile string `config:"shared_credentials_file"`
|
||||||
|
Profile string `config:"profile"`
|
||||||
SessionToken string `config:"session_token"`
|
SessionToken string `config:"session_token"`
|
||||||
UploadConcurrency int `config:"upload_concurrency"`
|
UploadConcurrency int `config:"upload_concurrency"`
|
||||||
ForcePathStyle bool `config:"force_path_style"`
|
ForcePathStyle bool `config:"force_path_style"`
|
||||||
|
@ -1166,7 +1193,10 @@ func s3Connection(opt *Options) (*s3.S3, *session.Session, error) {
|
||||||
// A SharedCredentialsProvider retrieves credentials
|
// A SharedCredentialsProvider retrieves credentials
|
||||||
// from the current user's home directory. It checks
|
// from the current user's home directory. It checks
|
||||||
// AWS_SHARED_CREDENTIALS_FILE and AWS_PROFILE too.
|
// AWS_SHARED_CREDENTIALS_FILE and AWS_PROFILE too.
|
||||||
&credentials.SharedCredentialsProvider{},
|
&credentials.SharedCredentialsProvider{
|
||||||
|
Filename: opt.SharedCredentialsFile, // If empty will look for "AWS_SHARED_CREDENTIALS_FILE" env variable.
|
||||||
|
Profile: opt.Profile, // If empty will look gor "AWS_PROFILE" env var or "default" if not set.
|
||||||
|
},
|
||||||
|
|
||||||
// Pick up IAM role if we're in an ECS task
|
// Pick up IAM role if we're in an ECS task
|
||||||
defaults.RemoteCredProvider(*def.Config, def.Handlers),
|
defaults.RemoteCredProvider(*def.Config, def.Handlers),
|
||||||
|
|
Loading…
Add table
Reference in a new issue