UNPKG

@house-agency/brewtils

Version:

The Brewery Node.js Utilities (brewtils)

36 lines (28 loc) 924 B
config ====== ::javascript const conf = require('brewtils/config'); // Load json configuration file and change the global config // state so the loaded data will be available everywhere in // the application scope. conf.load('config.json'); // config.json looks like this /* { "some-level-1": { "some-level-2": { "property": "value" } } } */ // Get config data with a fallback value const config_value = conf('some-level-1.some-level-2.property', 'fallback'); // Clear all config data conf.clear(); // Load and then merge more json data into current state. // Useful for global.json and local-environment.json conf.load('global.config.json'); conf.set({key: 'value'}); // Which also is chainable conf.load('global.config.json').set({key: 'value'});