aws-sdk-config-loader
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -14,5 +14,9 @@ 'use strict'; | ||
/** | ||
* return region string load from config file or environment variables. | ||
* | ||
* @param {Object} AWS AWS SDK module | ||
* @return {string|undefined} | ||
*/ | ||
function regionProvider(AWS) { | ||
var filename = process.env.AWS_CONFIG_FILE || _path2['default'].join(process.env.HOME, '.aws', 'config'); | ||
var profile = process.env.AWS_PROFILE || 'default'; | ||
var region = process.env.AWS_REGION || process.env.AMAZON_REGION; | ||
@@ -22,3 +26,8 @@ if (region) { | ||
} | ||
var filename = process.env.AWS_CONFIG_FILE || process.env.HOME && _path2['default'].join(process.env.HOME, '.aws', 'config'); | ||
if (!filename) { | ||
return region; | ||
} | ||
try { | ||
var profile = process.env.AWS_PROFILE || 'default'; | ||
var configs = AWS.util.ini.parse(AWS.util.readFileSync(filename)); | ||
@@ -33,2 +42,8 @@ if (typeof configs[profile] === 'object') { | ||
/** | ||
* initialize AWS.config using regionProvider | ||
* | ||
* @param {Object} AWS AWS SDK module | ||
*/ | ||
function loader(AWS) { | ||
@@ -35,0 +50,0 @@ AWS.util.update(AWS.Config.prototype.keys, { |
{ | ||
"name": "aws-sdk-config-loader", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "AWS config file loader for CLI tools", | ||
@@ -36,2 +36,3 @@ "author": "moqada <moqada@gmail.com>", | ||
"build": "rm -r lib && babel src --out-dir lib", | ||
"publish": "npm run build && npm publish", | ||
"test": "eslint src && babel-node $(npm bin)/isparta cover --report text --report html $(npm bin)/_mocha -- --require test/hook test/*spec.js", | ||
@@ -38,0 +39,0 @@ "testing": "mocha --require test/hook --watch test/*spec.js" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4993
45
6