mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Fix #3979. CLI option aws-profile overrides AWS_PROFILE env var
This commit is contained in:
parent
6e6f0d56b7
commit
4e96ea77c4
@ -195,21 +195,19 @@ class AwsProvider {
|
||||
const result = {};
|
||||
const stageUpper = this.getStage() ? this.getStage().toUpperCase() : null;
|
||||
|
||||
let profile;
|
||||
if (this.options['aws-profile']) {
|
||||
profile = this.options['aws-profile'];
|
||||
} else if (this.serverless.service.provider.profile) {
|
||||
profile = this.serverless.service.provider.profile;
|
||||
}
|
||||
|
||||
// add specified credentials, overriding with more specific declarations
|
||||
impl.addCredentials(result, this.serverless.service.provider.credentials); // config creds
|
||||
impl.addProfileCredentials(result, profile);
|
||||
if (this.serverless.service.provider.profile) {
|
||||
// config profile
|
||||
impl.addProfileCredentials(result, this.serverless.service.provider.profile);
|
||||
}
|
||||
impl.addEnvironmentCredentials(result, 'AWS'); // creds for all stages
|
||||
impl.addEnvironmentProfile(result, 'AWS');
|
||||
impl.addEnvironmentCredentials(result, `AWS_${stageUpper}`); // stage specific creds
|
||||
impl.addEnvironmentProfile(result, `AWS_${stageUpper}`);
|
||||
|
||||
if (this.options['aws-profile']) {
|
||||
impl.addProfileCredentials(result, this.options['aws-profile']); // CLI option profile
|
||||
}
|
||||
result.region = this.getRegion();
|
||||
|
||||
const deploymentBucketObject = this.serverless.service.provider.deploymentBucketObject;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user