Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.
/ nconfetti Public archive

A nconf storage that provide the configuration be located in files with dir that build the namespaces

License

Notifications You must be signed in to change notification settings

5minds/nconfetti

Repository files navigation

nconfetti

nconfetti is a storage extension that support loading configuration files from folder. The folder extend the namespace of the config-files with the names of the folder and the filename without extension where the files are located.

Howto use it

'use strict';

const path = require('path');

const nconf = require('nconf');

require('nconfetti');

nconf.argv()
  .env('__');

nconf.use('Nconfetti', {path: path.resolve(__dirname, '../tests/configs/without_env')});

console.log(nconf.get('simple_config:entry'));

Try a sample

  • see samples/simple.js
  • run it with
    • npm install
    • node samples/simple.js
  • have fun

Description

After requiring nconfetti its storage will automagically be registered to nconf. Then it needs to be configured with pathand env.

The backend support dereferencing of JSON pointers with a synchronous usage of json-schema-deref

Config parameter

  • path: The path to load the config files from
  • env: Add the environment to the config path.
  • vars: A key value list of vars that will be evaluated within the config files (handlebars syntax is required)

About

A nconf storage that provide the configuration be located in files with dir that build the namespaces

Resources

License

Stars

Watchers

Forks

Packages

No packages published