exframe-configuration
TypeScript icon, indicating that this package has built-in type declarations

2.2.6 • Public • Published

exframe-Configuration

Setup

Use the environment variable CONFIG_STORE to set the configuration mode. The default is 'env', available is 'env' and 'vault'

CONFIG_STORE = 'ENV'

The configuration module will look for the variables in process.env.

CONFIG_STORE = 'VAULT'

The configuration module will look for the variables by using configuration files located at /vault/secrets. Each secret is saved in a separate file and read independently, if secret is not found, uses default value Environment variable names are used to match the file name required

API Reference

get(key)

(Promise) Gets a value in the configuration server ####Returns: JSON object value for the key ####Throws:

  • Error Exception
Param Type
key string

secret(key)

Get a value directly from the secret ####Returns: object value

Example

const config = require('exframe-configuration');

config.get('bb')
.then((response) => {
  console.log('success', response);
})
.catch((err) => {
  console.log('error', err);
});

// OUTPUT: success { TEST: 'TESTVALUE' }
const config = require('exframe-configuration');

var result = config.secret('mongo_url')

// OUTPUT: TESTVALUE

Example

const configModule = require('exframe-configuration').config;

const bbVal = configModule.default.bb;

// OUTPUT: success { bb: 'TESTVALUE' }

Readme

Keywords

none

Package Sidebar

Install

npm i exframe-configuration

Weekly Downloads

1,997

Version

2.2.6

License

ISC

Unpacked Size

12.5 kB

Total Files

14

Last publish

Collaborators

  • exzeodevops