{ "name": "rc", "version": "1.1.5", "description": "hardwired configuration loader", "main": "index.js", "browserify": "browser.js", "scripts": { "test": "set -e; node test/test.js; node test/ini.js; node test/nested-env-vars.js" }, "repository": { "type": "git", "url": "git+https://github.com/dominictarr/rc.git" }, "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", "keywords": [ "config", "rc", "unix", "defaults" ], "bin": { "rc": "./index.js" }, "author": { "name": "Dominic Tarr", "email": "dominic.tarr@gmail.com", "url": "dominictarr.com" }, "dependencies": { "deep-extend": "~0.4.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~1.0.4" }, "readme": "# rc\n\nThe non-configurable configuration loader for lazy people.\n\n## Usage\n\nThe only option is to pass rc the name of your app, and your default configuration.\n\n```javascript\nvar conf = require('rc')(appname, {\n //defaults go here.\n port: 2468,\n\n //defaults which are objects will be merged, not replaced\n views: {\n engine: 'jade'\n }\n});\n```\n\n`rc` will return your configuration options merged with the defaults you specify.\nIf you pass in a predefined defaults object, it will be mutated:\n\n```javascript\nvar conf = {};\nrequire('rc')(appname, conf);\n```\n\nIf `rc` finds any config files for your app, the returned config object will have\na `configs` array containing their paths:\n\n```javascript\nvar appCfg = require('rc')(appname, conf);\nappCfg.configs[0] // /etc/appnamerc\nappCfg.configs[1] // /home/dominictarr/.config/appname\nappCfg.config // same as appCfg.configs[appCfg.configs.length - 1]\n```\n\n## Standards\n\nGiven your application name (`appname`), rc will look in all the obvious places for configuration.\n\n * command line arguments (parsed by minimist)\n * environment variables prefixed with `${appname}_`\n * or use \"\\_\\_\" to indicate nested properties
_(e.g. `appname_foo__bar__baz` => `foo.bar.baz`)_\n * if you passed an option `--config file` then from that file\n * a local `.${appname}rc` or the first found looking in `./ ../ ../../ ../../../` etc.\n * `$HOME/.${appname}rc`\n * `$HOME/.${appname}/config`\n * `$HOME/.config/${appname}`\n * `$HOME/.config/${appname}/config`\n * `/etc/${appname}rc`\n * `/etc/${appname}/config`\n * the defaults object you passed in.\n\nAll configuration sources that were found will be flattened into one object,\nso that sources **earlier** in this list override later ones.\n\n\n## Configuration File Formats\n\nConfiguration files (e.g. `.appnamerc`) may be in either [json](http://json.org/example) or [ini](http://en.wikipedia.org/wiki/INI_file) format. The example configurations below are equivalent:\n\n\n#### Formatted as `ini`\n\n```\n; You can include comments in `ini` format if you want.\n\ndependsOn=0.10.0\n\n\n; `rc` has built-in support for ini sections, see?\n\n[commands]\n www = ./commands/www\n console = ./commands/repl\n\n\n; You can even do nested sections\n\n[generators.options]\n engine = ejs\n\n[generators.modules]\n new = generate-new\n engine = generate-backend\n\n```\n\n#### Formatted as `json`\n\n```javascript\n{\n // You can even comment your JSON, if you want\n \"dependsOn\": \"0.10.0\",\n \"commands\": {\n \"www\": \"./commands/www\",\n \"console\": \"./commands/repl\"\n },\n \"generators\": {\n \"options\": {\n \"engine\": \"ejs\"\n },\n \"modules\": {\n \"new\": \"generate-new\",\n \"backend\": \"generate-backend\"\n }\n }\n}\n```\n\nComments are stripped from JSON config via [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).\n\n> Since ini, and env variables do not have a standard for types, your application needs be prepared for strings.\n\n\n\n## Advanced Usage\n\n#### Pass in your own `argv`\n\nYou may pass in your own `argv` as the third argument to `rc`. This is in case you want to [use your own command-line opts parser](https://github.com/dominictarr/rc/pull/12).\n\n```javascript\nrequire('rc')(appname, defaults, customArgvParser);\n```\n\n## Pass in your own parser\n\nIf you have a special need to use a non-standard parser,\nyou can do so by passing in the parser as the 4th argument.\n(leave the 3rd as null to get the default args parser)\n\n```javascript\nrequire('rc')(appname, defaults, null, parser);\n```\n\nThis may also be used to force a more strict format,\nsuch as strict, valid JSON only.\n\n## Note on Performance\n\n`rc` is running `fs.statSync`-- so make sure you don't use it in a hot code path (e.g. a request handler) \n\n\n## License\n\nMulti-licensed under the two-clause BSD License, MIT License, or Apache License, version 2.0\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/dominictarr/rc/issues" }, "homepage": "https://github.com/dominictarr/rc#readme", "_id": "rc@1.1.5", "_shasum": "3bae28d7bed87d1ccb5863f8dce8c27f2ceee89c", "_resolved": "https://registry.npmjs.org/rc/-/rc-1.1.5.tgz", "_from": "rc@>=1.0.1 <2.0.0" }