From 56660fec55b3e305673d3bd08c03e20902814fcd Mon Sep 17 00:00:00 2001 From: Austen Collins Date: Fri, 29 Jan 2016 15:03:05 -0800 Subject: [PATCH] ProjectInit: fix profile usage --- lib/actions/ProjectInit.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/actions/ProjectInit.js b/lib/actions/ProjectInit.js index e8f054dec..221b5e67a 100644 --- a/lib/actions/ProjectInit.js +++ b/lib/actions/ProjectInit.js @@ -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