1.0.0 • Published 4 years ago

@tizh/config v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

@tizh/config


Easily read or write to your config from anywhere.

Example

Set config

const config = require('@tizh/config');

config.color = 'red';
config.port = 8080;
config.urls = {
    host_name : 'http://localhost',
    base_url : '/api',
}

Load your config from a file or js object

you can write your configs in a js file and load that file at start point of your application
//'env.config.js'
module.exports = { // your config stuff };

//app.js
config.setBulk(require('./path/to/env.config.js');

Read Config

console.log(config.color) //prints blue
console.log(config.port)  //prints 8080
console.log(config.urls.base_url) //prints  /api
1.0.0

4 years ago