@smithy/shared-ini-file-loader
[![NPM version](https://img.shields.io/npm/v/@smithy/shared-ini-file-loader/latest.svg)](https://www.npmjs.com/package/@smithy/shared-ini-file-loader) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/shared-ini-file-loader.svg)](https://www.npmjs.c
Last updated a year ago by smithy-team .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @smithy/shared-ini-file-loader 
SYNC missed versions from official npm registry.

@smithy/shared-ini-file-loader

NPM version NPM downloads

AWS Shared Configuration 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 files below, the promise returned by loadSharedConfigFiles would resolve with:

{
  configFile: {
    'default': {
      aws_access_key_id: 'foo',
      aws_secret_access_key: 'bar',
    },
    dev: {
      aws_access_key_id: 'foo1',
      aws_secret_access_key: 'bar1',
    },
    prod: {
      aws_access_key_id: 'foo2',
      aws_secret_access_key: 'bar2',
    },
    'testing host': {
      aws_access_key_id: 'foo4',
      aws_secret_access_key: 'bar4',
    }
  },
  credentialsFile: {
    'default': {
      aws_access_key_id: 'foo',
      aws_secret_access_key: 'bar',
    },
    dev: {
      aws_access_key_id: 'foo1',
      aws_secret_access_key: 'bar1',
    },
    prod: {
      aws_access_key_id: 'foo2',
      aws_secret_access_key: 'bar2',
    }
  },
}

If a file is not found, its key (configFile or credentialsFile) will instead have a value of an empty object.

Supported configuration

You may customize how the files are loaded by providing an options hash to the loadSharedConfigFiles function. The following options are supported:

  • 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 provider will use the value in the AWS_CONFIG_FILE environment variable or a default of ~/.aws/config.
  • ignoreCache - The provider will normally cache the contents of the files it loads. This option will force the provider to reload the files from disk. Defaults to false.

Sample files

~/.aws/credentials

[default]
aws_access_key_id=foo
aws_secret_access_key=bar

[dev]
aws_access_key_id=foo2
aws_secret_access_key=bar2

[prod]
aws_access_key_id=foo3
aws_secret_access_key=bar3

~/.aws/config

[default]
aws_access_key_id=foo
aws_secret_access_key=bar

[profile dev]
aws_access_key_id=foo2
aws_secret_access_key=bar2

[profile prod]
aws_access_key_id=foo3
aws_secret_access_key=bar3

[profile "testing host"]
aws_access_key_id=foo4
aws_secret_access_key=bar4

Current Tags

  • 3.1.12                                ...           latest (16 days ago)

50 Versions

  • 3.1.12                                ...           16 days ago
  • 3.1.11                                ...           a month ago
  • 3.1.10                                ...           a month ago
  • 3.1.9                                ...           2 months ago
  • 3.1.8                                ...           3 months ago
  • 3.1.7                                ...           3 months ago
  • 3.1.6                                ...           3 months ago
  • 3.1.5                                ...           4 months ago
  • 3.1.4                                ...           6 months ago
  • 3.1.3                                ...           6 months ago
  • 3.1.2                                ...           6 months ago
  • 3.1.1                                ...           6 months ago
  • 3.1.0                                ...           7 months ago
  • 3.0.0                                ...           7 months ago
  • 2.4.0                                ...           9 months ago
  • 2.3.5                                ...           10 months ago
  • 2.3.4                                ...           10 months ago
  • 2.3.3                                ...           10 months ago
  • 2.3.2                                ...           10 months ago
  • 2.3.1                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.8                                ...           a year ago
  • 2.2.7                                ...           a year ago
  • 2.2.6                                ...           a year ago
  • 2.2.5                                ...           a year ago
  • 2.2.4                                ...           a year ago
  • 2.2.3                                ...           a year ago
  • 2.2.2                                ...           a year ago
  • 2.2.1                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           a year ago
  • 2.0.13                                ...           a year ago
  • 2.0.12                                ...           a year ago
  • 2.0.11                                ...           a year ago
  • 2.0.10                                ...           a year ago
  • 2.0.9                                ...           a year ago
  • 2.0.8                                ...           a year ago
  • 2.0.7                                ...           a year ago
  • 2.0.6                                ...           a year ago
  • 2.0.5                                ...           a year ago
  • 2.0.4                                ...           a year ago
  • 2.0.3                                ...           a year ago
  • 2.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.3 [deprecated]           ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE