Blueconfig

Blueconfig

new Blueconfig()

Source:

Static version of BlueConfigCore, with standard getters/formats:

Blueconfig.addGetter('default', (value, schema, stopPropagation) => schema._cvtCoerce(value))
Blueconfig.sortGetters(['default', 'value']) // set default before value
Blueconfig.addGetter('env', function(value, schema, stopPropagation) {
  return schema._cvtCoerce(this.getEnv()[value])
})
Blueconfig.addGetter('arg', function(value, schema, stopPropagation) {
  const argv = parseArgs(this.getArgs(), {
    configuration: {
      'dot-notation': false
    }
  })
  return schema._cvtCoerce(argv[value])
}, true)

Blueconfig.addFormats(require('./format/standard-formats.js'))
Example
const schema = { port: { default: 80, format: 'port' } }
const conf = blueconfig(schema);