How to use the configue.withOptions function in configue

To help you get started, we’ve selected a few configue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AdrieanKhisbe / configue / examples / basic-with-async-hooks.js View on Github external
const Configue = require('configue');

const configueOptions = {
  async: true,
  postHooks: {
    argv: function postArgv(nconf) {
      // Perform some async operation to fetch value on mongo, etcd, api or else
      return Promise.resolve('42').then(apiValue => {
        nconf.set('hook', `async post-argv hook:${apiValue}`);
      });
    }
  }
};

Configue.withOptions(configueOptions).resolve(configue => {
  const who = configue.get('who', 'World');
  const hook = configue.get('hook', 'none');

  console.log(`Configue: {who: ${who}, hook: ${hook}}`);
});
github AdrieanKhisbe / configue / examples / async-with-protocalls.js View on Github external
const Configue = require('configue');

const configueOptions = {
  async: true,
  disable: {env: true},
  protocall: true,
  files: [{file: './config-with-protocalls.json'}]
};

Configue.withOptions(configueOptions)
  .resolve()
  .then(configue => {
    console.log(`Secret ${configue.get('salute', 'Hello')} to ${configue.get('who', 'World')}`);
  });

configue

Configue is a config library to easily customize your app from argv, env, files and more.

MIT
Latest version published 2 years ago

Package Health Score

40 / 100
Full package analysis

Popular configue functions