Skip to content

Latest commit

 

History

History
42 lines (24 loc) · 946 Bytes

README.md

File metadata and controls

42 lines (24 loc) · 946 Bytes

dotcnf

npm npm npm

Deadly simple environment variables for Node JS

Installation

npm install --save dotcnf

Usage

Create .cnf file in your project root directory and put your configuration with key=pair and new-line separated. Example :

APIKEY=zzz
APISECRET=yyy

Then in your app :

const config = require( 'dotcnf' )();
// Access config data
console.log( config.APIKEY );
console.log( config.APISECRET );

In case your .cnf file is not in your project root directory, you can pass parameter when require the file.

const config = require( 'dotcnf' )( '../../.cnf' );

License

MIT