Skip to content

Instantly share code, notes, and snippets.

@dweinstein
Last active June 10, 2016 14:41
Show Gist options
  • Save dweinstein/8e7e7dfd57dae35367b9adc7de774066 to your computer and use it in GitHub Desktop.
Save dweinstein/8e7e7dfd57dae35367b9adc7de774066 to your computer and use it in GitHub Desktop.

Revisions

  1. dweinstein revised this gist Jun 10, 2016. No changes.
  2. dweinstein renamed this gist Jun 10, 2016. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions gistfile1.txt → example.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@


    ```
    ```js
    // config.js
    const config = require('rc')('setupios', {
    default: 'value',
    @@ -9,18 +9,22 @@ const config = require('rc')('setupios', {
    }
    });

    ```

    ```js
    module.exports = config;
    // index.js
    'use strict';

    const cfg = require('./config');

    console.log(cfg);
    ```

    which allows overriding the config via ENV and CLI as well:

    node index.js --default foo --other.value ok

    and

    setupios_default=foo setupios_thing__blah=blah2 node index.js
    ```
    setupios_default=foo setupios_thing__blah=blah2 node index.js
  3. dweinstein created this gist Jun 10, 2016.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@


    ```
    // config.js
    const config = require('rc')('setupios', {
    default: 'value',
    other: {
    thing: 'blah'
    }
    });

    module.exports = config;
    // index.js
    'use strict';

    const cfg = require('./config');

    console.log(cfg);
    which allows overriding the config via ENV and CLI as well:

    node index.js --default foo --other.value ok

    and

    setupios_default=foo setupios_thing__blah=blah2 node index.js
    ```