diff options
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/aws/session/session.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/aws/session/session.go | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 4792d3a..9f75d5a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go | |||
@@ -155,6 +155,10 @@ type Options struct { | |||
155 | // and enable or disable the shared config functionality. | 155 | // and enable or disable the shared config functionality. |
156 | SharedConfigState SharedConfigState | 156 | SharedConfigState SharedConfigState |
157 | 157 | ||
158 | // Ordered list of files the session will load configuration from. | ||
159 | // It will override environment variable AWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE. | ||
160 | SharedConfigFiles []string | ||
161 | |||
158 | // When the SDK's shared config is configured to assume a role with MFA | 162 | // When the SDK's shared config is configured to assume a role with MFA |
159 | // this option is required in order to provide the mechanism that will | 163 | // this option is required in order to provide the mechanism that will |
160 | // retrieve the MFA token. There is no default value for this field. If | 164 | // retrieve the MFA token. There is no default value for this field. If |
@@ -239,6 +243,13 @@ func NewSessionWithOptions(opts Options) (*Session, error) { | |||
239 | envCfg.EnableSharedConfig = true | 243 | envCfg.EnableSharedConfig = true |
240 | } | 244 | } |
241 | 245 | ||
246 | if len(envCfg.SharedCredentialsFile) == 0 { | ||
247 | envCfg.SharedCredentialsFile = defaults.SharedCredentialsFilename() | ||
248 | } | ||
249 | if len(envCfg.SharedConfigFile) == 0 { | ||
250 | envCfg.SharedConfigFile = defaults.SharedConfigFilename() | ||
251 | } | ||
252 | |||
242 | // Only use AWS_CA_BUNDLE if session option is not provided. | 253 | // Only use AWS_CA_BUNDLE if session option is not provided. |
243 | if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { | 254 | if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { |
244 | f, err := os.Open(envCfg.CustomCABundle) | 255 | f, err := os.Open(envCfg.CustomCABundle) |
@@ -304,13 +315,18 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, | |||
304 | userCfg := &aws.Config{} | 315 | userCfg := &aws.Config{} |
305 | userCfg.MergeIn(cfgs...) | 316 | userCfg.MergeIn(cfgs...) |
306 | 317 | ||
307 | // Order config files will be loaded in with later files overwriting | 318 | // Ordered config files will be loaded in with later files overwriting |
308 | // previous config file values. | 319 | // previous config file values. |
309 | cfgFiles := []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} | 320 | var cfgFiles []string |
310 | if !envCfg.EnableSharedConfig { | 321 | if opts.SharedConfigFiles != nil { |
311 | // The shared config file (~/.aws/config) is only loaded if instructed | 322 | cfgFiles = opts.SharedConfigFiles |
312 | // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). | 323 | } else { |
313 | cfgFiles = cfgFiles[1:] | 324 | cfgFiles = []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} |
325 | if !envCfg.EnableSharedConfig { | ||
326 | // The shared config file (~/.aws/config) is only loaded if instructed | ||
327 | // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). | ||
328 | cfgFiles = cfgFiles[1:] | ||
329 | } | ||
314 | } | 330 | } |
315 | 331 | ||
316 | // Load additional config from file(s) | 332 | // Load additional config from file(s) |