mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
ProjectInit: fix profile usage
This commit is contained in:
parent
90eb9197e0
commit
56660fec55
@ -258,24 +258,24 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
.then(function() {
|
||||
|
||||
// If profile exists, skip select prompt
|
||||
if (_this.profile) return;
|
||||
if (_this.evt.options.profile) return;
|
||||
|
||||
// If aws credentials were passed, skip select prompt
|
||||
if (_this.S.config.awsAdminKeyId && _this.S.config.awsAdminSecretKey) return;
|
||||
|
||||
// Prompt: profile select
|
||||
let choices = [];
|
||||
for (let i = 0; i < _this.profiles.length; i++) {
|
||||
for (let i = 0; i < _this.evt.options.profiles.length; i++) {
|
||||
choices.push({
|
||||
key: '',
|
||||
value: _this.profiles[i],
|
||||
label: _this.profiles[i]
|
||||
value: _this.evt.options.profiles[i],
|
||||
label: _this.evt.options.profiles[i]
|
||||
});
|
||||
}
|
||||
|
||||
return _this.cliPromptSelect('Select an AWS profile for your project: ', choices, false)
|
||||
.then(results => {
|
||||
_this.profile = results[0].value;
|
||||
_this.evt.options.profile = results[0].value;
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -291,9 +291,9 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
this.AwsMisc = require('../utils/aws/Misc');
|
||||
|
||||
// If Profile, extract API Keys
|
||||
if (this.profile) {
|
||||
this.S.config.awsAdminKeyId = this.AwsMisc.profilesGet(this.profile)[this.profile].aws_access_key_id;
|
||||
this.S.config.awsAdminSecretKey = this.AwsMisc.profilesGet(this.profile)[this.profile].aws_secret_access_key;
|
||||
if (this.evt.options.profile) {
|
||||
this.S.config.awsAdminKeyId = this.AwsMisc.profilesGet(this.evt.options.profile)[this.evt.options.profile].aws_access_key_id;
|
||||
this.S.config.awsAdminSecretKey = this.AwsMisc.profilesGet(this.evt.options.profile)[this.evt.options.profile].aws_secret_access_key;
|
||||
}
|
||||
|
||||
// Validate API Keys
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user