1.0.0 • Published 7 years ago

osio-config v1.0.0

Weekly downloads
3
License
UNLICENSED
Repository
github
Last release
7 years ago

Node OS Config

Example

BOOLEAN: true
STRING: random string
ARRAY:
  - string 1
  - string 2
  - string 3
Number: 1
'use strict';

const {setConfigPath, getConfig, arrayConfig, booleanConfig} = require('../index');

setConfigPath(__dirname);

getConfig('BOOLEAN', booleanConfig);
getConfig('ARRAY', arrayConfig);
getConfig('NUMBER', Number);

Priority

Highest -> Lowest

  1. .env file
  2. process enviorment
  3. specified configuration file when using setConfigPath() method

Loading Config Files

Config files are currently loaded based on NODE_ENV=<env-name>. See below example ...

process.env.NODE_ENV = 'development';
setConfigPath(__dirname); // Loads __dirname/development.yml

TODO

  1. Add circle ci support
  2. Better documentation
  3. Add cli arguments support
  4. Add support for addtional configuration file extensions other than .yml