Skip to content


Folders and files

Last commit message
Last commit date

Latest commit



20 Commits

Repository files navigation

muchconf consul provider

npm Build Status

Muchconf configuration provider for consul KV store. It supports application reloading on configuration update.

Consul is a distributed service mesh to connect, secure, and configure services across any runtime platform and public or private cloud (see:

Getting started

Install module using your favorite package manager.

npm install muchconf-consul-provider

Create muchconf configuration store with consul provider. key is name of directory in consul store where configuration is kept. See muchconf repository for more information how to use store.

const { muchconf } = require('muchconf');
const { muchConsul } = require('muchconf-conusl-provider');

const configStore = muchconf([
        key: 'myService'

configStore.on('ready', (config) => {
    console.log('Service running at ' + config.ip + ':' + confgi.port);


Class: ConsulProvider


new ConsulProvider(options, commonProviderOptions);


muchConsul(options, commonProviderOptions);
name type required default description
options object yes options for consul provider string no agent address (see: silas/node-consul)
options.port number no 8500 agent HTTP(S) port (see: silas/node-consul) boolean no false enable HTTPS (see: silas/node-consul) String[] no array of strings or Buffers of trusted certificates in PEM format (see: silas/node-consul)
options.defaults object no common method call options that will be included with every call (ex: set default token), these options can be override on a per call basis (see: silas/node-consul)
options.key string yes the consul directory where configuration is stored
options.watchInterval number no the time in milliseconds to wait in between checking of configuration update
commonProviderOptions object no see below common options for provider
commonProviderOptions.castNumbers boolean no false if possible, strings will be converted to number, e.g. '2' will be 2
commonProviderOptions.convertTrueFalseStrings boolean no false strings like 'true' or 'false' will be converted to boolean
commonProviderOptions.cutQuotations boolean no false double quotation marks form beginning and ending of string will be cut off. E.g. '"some value"' will be 'some value'
commonProviderOptions.not object no conditions when provider should not be used object no conditions when provider should be used


update fired on configuration change if configuration watching is enabled.


npm run test