diff --git a/src/commands/code-binding/index.js b/src/commands/code-binding/index.js index 063000d..320f16f 100644 --- a/src/commands/code-binding/index.js +++ b/src/commands/code-binding/index.js @@ -9,7 +9,7 @@ program .option("-n, --type-name [typeName]", "Type name", "MyType") .option("-p, --profile [profile]", "AWS profile to use") .option( - "--region [region]", + "-r, --region [region]", "The AWS region to use. Falls back on AWS_REGION environment variable if not specified" ) .option( diff --git a/src/commands/shared/auth-helper.js b/src/commands/shared/auth-helper.js index d117e07..5a86a5f 100644 --- a/src/commands/shared/auth-helper.js +++ b/src/commands/shared/auth-helper.js @@ -3,6 +3,7 @@ require("@mhlabs/aws-sdk-sso"); function initAuth(cmd) { + AWS.config.region = cmd.region || process.env.AWS_REGION || AWS.config.region const credentials = new AWS.SharedIniFileCredentials({ profile: cmd.profile }); if (credentials.accessKeyId) { AWS.config.credentials = credentials; @@ -12,7 +13,6 @@ function initAuth(cmd) { new AWS.SingleSignOnCredentials() ); } - process.env.AWS_REGION = cmd.region || process.env.AWS_REGION || AWS.config.region } module.exports = {