fetch-secret-identifier

0.1.0 • Public • Published

Fetch Secret Identifier

Development

  1. Create the below environments in your .env(dotenv)
AWS_ACCESS_KEY=xxx
AWS_SECRET_KEY=xxx
DEV_ENV_PATH=xxx
AWS_REGION=xxxx
SM_REMOTE=true
  • DEV_ENV_PATH is your local environment configuration path, such as ${root}/config/environments/config.js. If you do not set it, the default is path.join(__dirname, './config/environments/config').

  • AWS_REGION, default is us-west-2

  • SM_REMOTE, if you want to debug local development, and want to access AWS Secret Manager. You could set SM_REMOTE as true. You could ignore by default.

Example

  • getSecretValue
const sm = require('fetch-secret-identifier');
sm.getSecretValue('<your identifier>', (data) => {
  // your code
});
  • getSecretValueAsync
const sm = require('fetch-secret-identifier');

(async () => {
  try {
    // access your key in identifier
    const { username, password, host } = await sm.getSecretValueAsync('ui/model-mysql/demo');
  } catch (err) {
    console.error(err);
  }
})();

Package Sidebar

Install

npm i fetch-secret-identifier

Weekly Downloads

8

Version

0.1.0

License

MIT

Unpacked Size

5.46 kB

Total Files

3

Last publish

Collaborators

  • tangtang918