-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
32 lines (32 loc) · 2.31 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
"name": "config-chain",
"version": "0.3.4",
"description": "HANDLE CONFIGURATION ONCE AND FOR ALL",
"homepage": "http://github.com/dominictarr/config-chain",
"repository": {
"type": "git",
"url": "https://github.com/dominictarr/config-chain.git"
},
"dependencies": {
"proto-list": "1",
"ini": "~1.0.2"
},
"devDependencies": {
"tap": "0.3.0"
},
"author": {
"name": "Dominic Tarr",
"email": "dominic.tarr@gmail.com",
"url": "http://dominictarr.com"
},
"scripts": {
"test": "tap test/"
},
"readme": "#config-chain\n\nUSE THIS MODULE TO LOAD ALL YOUR CONFIGURATIONS\n\n``` js\n\n //npm install config-chain\n\n var cc = require('config-chain')\n , opts = require('optimist').argv //ALWAYS USE OPTIMIST FOR COMMAND LINE OPTIONS.\n , env = opts.env || process.env.YOUR_APP_ENV || 'dev' //SET YOUR ENV LIKE THIS.\n\n // EACH ARG TO CONFIGURATOR IS LOADED INTO CONFIGURATION CHAIN\n // EARLIER ITEMS OVERIDE LATER ITEMS\n // PUTS COMMAND LINE OPTS FIRST, AND DEFAULTS LAST!\n\n //strings are interpereted as filenames.\n //will be loaded synchronously\n\n var conf = \n cc(\n //OVERRIDE SETTINGS WITH COMMAND LINE OPTS\n opts,\n\n //ENV VARS IF PREFIXED WITH 'myApp_'\n\n cc.env('myApp'), //myApp_foo = 'like this'\n\n //FILE NAMED BY ENV\n path.join(__dirname, 'config.' + env + '.json'), \n\n //IF `env` is PRODUCTION\n env === 'prod' \n ? path.join(__dirname, 'special.json') //load a special file\n : null //NULL IS IGNORED!\n\n //SUBDIR FOR ENV CONFIG\n path.join(__dirname, 'config', env, 'config.json'), \n \n //SEARCH PARENT DIRECTORIES FROM CURRENT DIR FOR FILE\n cc.find('config.json'),\n \n //PUT DEFAULTS LAST\n { \n host: 'localhost'\n port: 8000\n })\n\n var host = conf.get('host')\n \n // or\n\n var host = conf.store.host\n\n```\nFINALLY, EASY FLEXIBLE CONFIGURATIONS!\n\n##see also: (proto-list)[https://github.com/isaacs/proto-list/]\n\n\n##TODO\n\n * add support for more types of parser, \n yaml, ini, whatever I can find in npm.\n * if string is http://... load config from internet. (useful for devops)\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/dominictarr/config-chain/issues"
},
"_id": "config-chain@0.3.4",
"_from": "config-chain@~0.3"
}