Skip to content
Snippets Groups Projects

config

pipeline status coverage report Quality Gate Status

Simple Config Log with HashiCorp Vault support.

Installation

  • npm config set @br:registry https://it-devops-01:4873
  • npm install --save @br/config

Usage

const Config = require('@br/config')
let config = new Config()

Then config is your config object. (Use it like config.setting)

It reads from the following sources, performing a deep merge:
(The Top Value overwrites the lower ones)

  • ENV
  • config.json
  • config.defaults.json

Examples

Only config.defaults.json

node examples/only-defaults/index.js

Only config.json

(Kind of legacy use)

node examples/only-local/index.js

defaults and config.json

node examples/defaults-overwrite/index.js

enviroment variables

(Enviroment set by command to not pollute your machine)

setting=overwritten-by-env node examples/env/index.js

TODO / Missing

  • hashicorp values support: if value == "vault:", treat it as secret