Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/debitoor/cnf
Configuration loader.
https://github.com/debitoor/cnf
Last synced: 12 days ago
JSON representation
Configuration loader.
- Host: GitHub
- URL: https://github.com/debitoor/cnf
- Owner: debitoor
- Created: 2012-09-24T10:13:16.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2020-10-27T09:58:59.000Z (about 4 years ago)
- Last Synced: 2024-10-13T11:37:09.722Z (about 1 month ago)
- Language: JavaScript
- Size: 114 KB
- Stars: 3
- Watchers: 49
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
cnf [![npm version](https://badge.fury.io/js/cnf.svg)](http://badge.fury.io/js/cnf) [![Build Status](https://travis-ci.org/debitoor/cnf.svg?branch=master)](https://travis-ci.org/debitoor/cnf) [![Dependency Status](https://david-dm.org/debitoor/cnf.svg)](https://david-dm.org/debitoor/cnf) [![devDependency Status](https://david-dm.org/debitoor/cnf/dev-status.svg)](https://david-dm.org/debitoor/cnf#info=devDependencies)
===Configuration loader.
npm install -SE cnf
To use it simply require it:
```js
var config = require('cnf');console.log('port: ' + config.http.port);
```It will look for a configuration file called `/config/$APP_ENV.js` in the current working directory and will be extended with config from `global.js`.
To override configs use a command line argument prefixed with `app.`
node example.js --app.http.port 8080
The above line override `http.port` with `8080`
To refer to another part of the config use
```js
{
port: 8080,
siteUrl: "http://localhost:$(port)" //this will be "http://localhost:8080"
}
```Add a regexp using
```
--app.mySetting "$regexp(/myRegExp/gmi)"
```