3.0.0 • Published 5 years ago

serviser-config v3.0.0

Weekly downloads
5
License
GPL-3.0
Repository
github
Last release
5 years ago

Build Status

Configuration plugin for serviser
Loads an application config file from a fs path which defaults to <project_root>/config/config.js.
The config file can also be in json format given that you provide serviser with custom file path:

project-root> ./node_modules/.bin/serviser run --config ./config/config.json

Usage examples:

  • let serviser load its configuration from default fs path
    const Service = require('serviser');
    const Config = require('serviser-config');

    const service = new Service(Config);
  • provide serviser with in-memory config object
    const Service = require('serviser');
    const Config = require('serviser-config');


    const config = Config.createMemoryProvider({
        //...config content
    });

    const service = new Service(config);
  • set config value
    config.set("path:to:nested:option", value);
  • get config value
    var value = config.get("path:to:nested:option");
    var value = config.getOrFail("path:to:nested:option"); //throws if value === undefined