Skip to content

Instantly share code, notes, and snippets.

@kessler
Created July 9, 2014 10:50
Show Gist options
  • Save kessler/005c3bf91c3ce51ad53a to your computer and use it in GitHub Desktop.
Save kessler/005c3bf91c3ce51ad53a to your computer and use it in GitHub Desktop.
using RC example
//
// config.js
//
var rc = require('rc')
// name and defaults
module.exports = rc('coolModule', {
port: 8080,
spec: {
dir: 'a/path/to/somewhere',
timeout: 5
}
})
//
// index.js
//
var config = require('./config.js')
console.log(config.port)
//
// in command line
//
> node index.js
8080
> node index.js --port=9090
9090
> export coolModule_port=7070
> node index.js
7070
> echo '{ "port": 6060 }' > /home/ec2-user/.coolModulerc
> node index.js
6060
> node index.js --spec.timeout=10 //change timeout to 10
for more options see
https://github.com/dominictarr/rc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment