1.1.4 • Published 7 years ago

easydotconfig v1.1.4

Weekly downloads
64
License
ISC
Repository
github
Last release
7 years ago

Dotconfig

A small library providing utility to load configuration files with dot notation. Uses memory caching for already loaded files.

Installation

  npm install easydotconfig --save

Usage

Create a configuration file

   export default {
	    host: process.env.DB_HOST,
	    user: 'user',
	    password: 'password',
   }

Import package and assign it to a variable

   import easydotconfig from 'easydotconfig';

   const config = easydotconfig();

Above will import config files from within 'config' directory in your root folder. To specify a custom directory within root dir just do:

   const config = easydotconfig('src'); // to get config files from './src/config'

Then use the following to retrieve the configuration

   console.log(config('db.host')); // will print the 'host' from db.js file in config dir

   console.log(config('non_existent.nothing', 'fallback value'); // will print 'fallback value'
   
   console.log(config('db'); // will print entire db configuration
1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago