2.2.6 • Published 7 months ago

exframe-configuration v2.2.6

Weekly downloads
325
License
ISC
Repository
bitbucket
Last release
7 months ago

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
ParamType
keystring

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' }
2.2.5

8 months ago

2.2.6

7 months ago

2.2.4

2 years ago

2.2.1

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

4 years ago

1.1.3

6 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

8 years ago