settings.json

Super simple, environment aware, JSON settings handler

Usage no npm install needed!

<script type="module">
  import settingsJson from 'https://cdn.skypack.dev/settings.json';
</script>

README

settings.json

Super simple, environment aware, JSON settings reader for NodeJS.

Build Status

Installation

npm install settings.json

Get started

var settings = require('settings.json')(__dirname + '/config/settings.json', 'development');

Usage

require('settings.json')(<input> [, <environment> [, <options>]])

<input>           One or many paths for settings file(s). Files are loaded in specified order
                  and overlapping settings from the previous file will be overridden with the ones
                  from latter one.
                  
<environment>     Environment to select from the settings, defaults to "production".

<options>         Object with additional options. Supported options:

                  options.quiet:
                      
                      Do not throw if file doesn't exist or it's content is invalid JSON. Defaults to false.

Examples

Check out tests.