conf-stack

0.0.7 • Public • Published

Configuration Stacks

This module provides a configuration factory

Sample usage

Install through npm

npm install conf-stack

By default conf-stack expects for you to have at least created a directory named conf at the working directory process.cwd(), within that directory conf-stacks expects a file base.yaml, this file will always be loaded into the returned config.

===

base.yaml

Basic sample, configuration that does not contain sensitive data

  • conf
    • base.yaml
  • index.js (sample code)
var getconf = require('conf-stack');
var config  = getconf();

console.log(config);

Run node index.js

===

env.yaml

Adding a non commited env.yaml for sensitive data (the env.yaml will be merged over base.yaml)

Within config dir

  • conf
    • base.yaml
    • env.yaml
  • index.js (sample code)

Or sibling of main process

  • conf
    • base.yaml
  • index.js (sample code)
  • env.yaml

Or at working directory node some/location/index.js

  • some
    • location
      • conf
        • base.yaml
      • index.js
  • env.yaml

===

Stacked

Stacked sample (the config object will have dev merged into base, and any env merged over the result)

  • conf
    • base.yaml
    • dev.yaml
  • index.js (sample code)
var getconf = require('conf-stack');
var config  = getconf();

console.log(config);

Run node index.js --confstack=dev

===

Factory:

require('conf-stack')([baseDir],[argName]);

===

Command Line

As a command line utility (also base, c,o,n,f,i,g,s, env):

Usages

  • Calling from a different language or process
  • Calling just to analyse a conf directory
  • Calling to create an output properties file using the prop format
# If you are in a directory with a child conf/base.yaml you can just call conf-stack
conf-stack
conf-stack --confstackrun prop
conf-stack --confstackrun json
conf-stack --confstackrun json --confstack somefile
conf-stack --confstackrun json --confstackdir some/relative/dir

Package Sidebar

Install

npm i conf-stack

Weekly Downloads

4

Version

0.0.7

License

MIT

Last publish

Collaborators

  • juliostanley