osio-config

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i osio-config

Weekly Downloads

10

Version

1.0.0

License

UNLICENSED

Last publish

Collaborators

  • osio