@aws-sdk/shared-ini-file-loader
Advanced tools
Comparing version 0.1.0-preview.1 to 0.1.0-preview.2
@@ -6,10 +6,10 @@ "use strict"; | ||
var fs_1 = require("fs"); | ||
exports.ENV_CREDENTIALS_PATH = 'AWS_SHARED_CREDENTIALS_FILE'; | ||
exports.ENV_CONFIG_PATH = 'AWS_CONFIG_FILE'; | ||
exports.ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; | ||
exports.ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; | ||
var swallowError = function () { return ({}); }; | ||
function loadSharedConfigFiles(init) { | ||
if (init === void 0) { init = {}; } | ||
var _a = init.filepath, filepath = _a === void 0 ? process.env[exports.ENV_CREDENTIALS_PATH] | ||
|| path_1.join(getHomeDir(), '.aws', 'credentials') : _a, _b = init.configFilepath, configFilepath = _b === void 0 ? process.env[exports.ENV_CONFIG_PATH] | ||
|| path_1.join(getHomeDir(), '.aws', 'config') : _b; | ||
var _a = init.filepath, filepath = _a === void 0 ? process.env[exports.ENV_CREDENTIALS_PATH] || | ||
path_1.join(getHomeDir(), ".aws", "credentials") : _a, _b = init.configFilepath, configFilepath = _b === void 0 ? process.env[exports.ENV_CONFIG_PATH] || | ||
path_1.join(getHomeDir(), ".aws", "config") : _b; | ||
return Promise.all([ | ||
@@ -22,3 +22,3 @@ slurpFile(configFilepath) | ||
.then(parseIni) | ||
.catch(swallowError), | ||
.catch(swallowError) | ||
]).then(function (parsedFiles) { | ||
@@ -28,3 +28,3 @@ var configFile = parsedFiles[0], credentialsFile = parsedFiles[1]; | ||
configFile: configFile, | ||
credentialsFile: credentialsFile, | ||
credentialsFile: credentialsFile | ||
}; | ||
@@ -40,6 +40,6 @@ }); | ||
var matches = void 0; | ||
if (key === 'default') { | ||
if (key === "default") { | ||
map.default = data.default; | ||
} | ||
else if (matches = profileKeyRegex.exec(key)) { | ||
else if ((matches = profileKeyRegex.exec(key))) { | ||
var _1 = matches[0], _2 = matches[1], normalizedKey = matches[2]; | ||
@@ -75,3 +75,3 @@ if (normalizedKey) { | ||
return new Promise(function (resolve, reject) { | ||
fs_1.readFile(path, 'utf8', function (err, data) { | ||
fs_1.readFile(path, "utf8", function (err, data) { | ||
if (err) { | ||
@@ -78,0 +78,0 @@ reject(err); |
{ | ||
"name": "@aws-sdk/shared-ini-file-loader", | ||
"version": "0.1.0-preview.1", | ||
"dependencies": { | ||
"tslib": "^1.8.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^20.0.2", | ||
"@types/node": "^8.10.29", | ||
"jest": "^20.0.4", | ||
"typescript": "^3.0.0" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "tsc", | ||
"pretest": "tsc -p tsconfig.test.json", | ||
"test": "jest" | ||
}, | ||
"author": { | ||
"name": "AWS SDK for JavaScript Team", | ||
"email": "aws-sdk-js@amazon.com", | ||
"url": "https://aws.amazon.com/javascript/" | ||
}, | ||
"license": "Apache-2.0", | ||
"main": "./build/index.js", | ||
"types": "./build/index.d.ts", | ||
"gitHead": "960970c0c25938a8d51d1a243d3f21f05acea92e" | ||
"name": "@aws-sdk/shared-ini-file-loader", | ||
"version": "0.1.0-preview.2", | ||
"dependencies": { | ||
"tslib": "^1.8.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.12", | ||
"@types/node": "^10.0.0", | ||
"jest": "^24.7.1", | ||
"typescript": "~3.4.0" | ||
}, | ||
"scripts": { | ||
"prepublishOnly": "tsc", | ||
"pretest": "tsc -p tsconfig.test.json", | ||
"test": "jest" | ||
}, | ||
"author": { | ||
"name": "AWS SDK for JavaScript Team", | ||
"email": "", | ||
"url": "https://aws.amazon.com/javascript/" | ||
}, | ||
"license": "Apache-2.0", | ||
"main": "./build/index.js", | ||
"types": "./build/index.d.ts" | ||
} |
# AWS Shared Configuration File Loader | ||
[![NPM version](https://img.shields.io/npm/v/@aws-sdk/shared-ini-file-loader/preview.svg)](https://www.npmjs.com/package/@aws-sdk/shared-ini-file-loader) | ||
[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/shared-ini-file-loader.svg)](https://www.npmjs.com/package/@aws-sdk/shared-ini-file-loader) | ||
This module provides a function that reads from AWS SDK configuration files and | ||
returns a promise that will resolve with a hash of the parsed contents of the | ||
AWS credentials file and of the AWS config file. Given the [sample | ||
AWS credentials file and of the AWS config file. Given the [sample | ||
files](#sample-files) below, the promise returned by `loadSharedConfigFiles` | ||
@@ -54,6 +57,6 @@ would resolve with: | ||
* `filepath` - The path to the shared credentials file. If not specified, the | ||
- `filepath` - The path to the shared credentials file. If not specified, the | ||
provider will use the value in the `AWS_SHARED_CREDENTIALS_FILE` environment | ||
variable or a default of `~/.aws/credentials`. | ||
* `configFilepath` - The path to the shared config file. If not specified, the | ||
- `configFilepath` - The path to the shared config file. If not specified, the | ||
provider will use the value in the `AWS_CONFIG_FILE` environment variable or a | ||
@@ -65,2 +68,3 @@ default of `~/.aws/config`. | ||
### `~/.aws/credentials` | ||
```ini | ||
@@ -81,2 +85,3 @@ [default] | ||
### `~/.aws/config` | ||
```ini | ||
@@ -83,0 +88,0 @@ [default] |
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es5", | ||
"strict": true, | ||
"sourceMap": true, | ||
"declaration": true, | ||
"lib": [ | ||
"es5", | ||
"es2015.promise", | ||
"es2015.collection" | ||
], | ||
"sourceRoot": "./src", | ||
"outDir": "./build", | ||
"importHelpers": true, | ||
"noEmitHelpers": true | ||
} | ||
} | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es5", | ||
"strict": true, | ||
"sourceMap": true, | ||
"declaration": true, | ||
"lib": ["es5", "es2015.promise", "es2015.collection"], | ||
"sourceRoot": "./src", | ||
"outDir": "./build", | ||
"importHelpers": true, | ||
"noEmitHelpers": true | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
22282
9
135
101