Skip to content

Commit

Permalink
Pass AWS_PROFILE value as an environment variable (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Seokju Hong authored and Andres Martinez Gotor committed Nov 22, 2019
1 parent 0658dc2 commit a31d128
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ function getToken(userInfo) {
cmd = `${cmd} ${args.join(' ')}`;
}
const env = _.get(userInfo, 'user.exec.env', []);
const envvars = Object.assign({}, process.env);
if (env) {
const profile = _.find(env, e => e.name === 'AWS_PROFILE');
if (profile) {
cmd = `${cmd} --profile ${profile.value}`;
envvars.AWS_PROFILE = profile.value;
}
}
let output = {};
try {
output = proc.execSync(cmd);
output = proc.execSync(cmd, envvars);
} catch (err) {
throw new Error(`Failed to refresh token: ${err.message}`);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-kubeless",
"version": "0.9.0",
"version": "0.9.1",
"description": "This plugin enables support for Kubeless within the [Serverless Framework](https://github.com/serverless).",
"main": "index.js",
"directories": {
Expand Down

0 comments on commit a31d128

Please sign in to comment.