Current release: 0.1.0-dev
Loco is a simple JavaScript module for loading configuration depending on an option flag. The most common use case is loading different configurations in different environments.
Installing via Yarn:
yarn add loco
Installing via npm:
npm install loco
The configuration file uses JSON format.
Create a configuration file (for example conf.json
):
{
"development": {
"debug": true,
"comments": "all"
},
"production": {
"debug": false,
"comments": "some"
}
}
Load in your script:
const loco = require('loco');
const config = loco.load('conf.json');
if (config.debug) {
console.log('Loco module successfully loaded');
}
Run in CLI:
node --env=development
load(file, optname = 'env'):
file
Path to the configuration file.
- Type:
string
optname
- Type:
string
- Default: 'env'
Open an issue or send a pull request on Github (http://github.com/loonies/loco).
Maintainer:
- Miodrag Tokić
Copyright (C) 2019 Miodrag Tokić.
Released under the MIT License. See the LICENSE file for details.