Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

convict

mozilla1.4mApache-2.06.2.4TypeScript support: definitely-typed

Featureful configuration management library for Node.js (nested structure, schema validation, etc.)

configuration, config, conf, key value store, schema, nested, validation, customize, env, environment, json, yaml, toml

readme

Convict

NPM version Build Status Coverage Status

Convict expands on the standard pattern of configuring node.js applications in a way that is more robust and accessible to collaborators, who may have less interest in digging through code in order to inspect or modify settings. By introducing a configuration schema, convict gives project collaborators more context on each setting and enables validation and early failures for when configuration goes wrong.

Features

  • Loading and merging: configurations are loaded from disk or inline and merged
  • Nested structure: keys and values can be organized in a tree structure
  • Environmental variables: values can be derived from environmental variables
  • Command-line arguments: values can also be derived from command-line arguments
  • Validation: configurations are validated against your schema (presence checking, type checking, custom checking), generating an error report with all errors that are found
  • Comments allowed: schema and configuration files can be either in the JSON format or in the newer JSON5 format, so comments are welcome
  • Configuration file additional types support: custom file type support can be used for the configuration file

Install

npm install convict

Usage

An example config.js file:

var convict = require('convict');

convict.addFormat(require('convict-format-with-validator').ipaddress);

// Define a schema
var config = convict({
  env: {
    doc: 'The application environment.',
    format: ['production', 'development', 'test'],
    default: 'development',
    env: 'NODE_ENV'
  },
  ip: {
    doc: 'The IP address to bind.',
    format: 'ipaddress',
    default: '127.0.0.1',
    env: 'IP_ADDRESS',
  },
  port: {
    doc: 'The port to bind.',
    format: 'port',
    default: 8080,
    env: 'PORT',
    arg: 'port'
  },
  db: {
    host: {
      doc: 'Database host name/IP',
      format: '*',
      default: 'server1.dev.test'
    },
    name: {
      doc: 'Database name',
      format: String,
      default: 'users'
    }
  },
  admins: {
    doc: 'Users with write access, or null to grant full access without login.',
    format: Array,
    nullable: true,
    default: null
  }
});

// Load environment dependent configuration
var env = config.get('env');
config.loadFile('./config/' + env + '.json');

// Perform validation
config.validate({allowed: 'strict'});

module.exports = config;

An example server.js file leveraging the config.js file above:

var http = require('http');
var config = require('./config.js');

var server = http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
});

// Consume
server.listen(config.get('port'), config.get('ip'), function(x) {
  var addy = server.address();
  console.log('running on http://' + addy.address + ':' + addy.port);
});

To launch your example server, and set a port:

node ./server.js --port 8080

Note: Command-line arguments must be supplied with a double-hyphen prefix (e.g. --arg). Single-hypen prefixes (e.g. -a) are not supported at this time.

The Schema

A configuration module, with its deep nested schema, could look like this:

config.js:

var config = convict({
  db: {
    name: {
      format: String,
      default: ''
    },
    synchro: {
      active: {
        format: 'Boolean',
        default: false
      },
      remote_url: {
        format: 'url',
        default: 'http://localhost:8080/'
      }
    }
  },
  secret: {
    doc: 'Secret used for session cookies and CSRF tokens',
    format: '*',
    default: '',
    sensitive: true
  }
});

config.loadFile(['./prod.json', './config.json']);

Each setting in the schema has the following possible properties, each aiding in convict's goal of being more robust and collaborator friendly.

  • Type information: the format property specifies either a built-in convict format (ipaddress, port, int, etc.), or it can be a function to check a custom format. During validation, if a format check fails it will be added to the error report.
  • Default values: Every setting must have a default value.
  • Environmental variables: If the variable specified by env has a value, it will overwrite the setting's default value. An environment variable may not be mapped to more than one setting.
  • Command-line arguments: If the command-line argument specified by arg is supplied, it will overwrite the setting's default value or the value derived from env.
  • Documentation: The doc property is pretty self-explanatory. The nice part about having it in the schema rather than as a comment is that we can call config.getSchemaString() and have it displayed in the output.
  • Sensitive values and secrets: If sensitive is set to true, this value will be masked to "[Sensitive]" when config.toString() is called. This helps avoid disclosing secret keys when printing configuration at application start for debugging purposes.
  • Null values: If nullable is set to true, the value counts as valid not only if it matches the specified format, but also when it is null.

Validation

In order to help detect misconfigurations, convict allows you to define a format for each setting. By default, convict checks if the value of the property has the same type (according to Object.prototype.toString.call) as the default value specified in the schema. You can define a custom format checking function in the schema by setting the format property.

convict provides several predefined formats for validation that you can use. Most of them are self-explanatory:

  • * - any value is valid
  • int
  • port
  • windows_named_pipe
  • port_or_windows_named_pipe
  • nat - positive integer (natural number)

You can find other format here.

If format is set to one of the built-in JavaScript constructors, Object, Array, String, Number, RegExp, or Boolean, validation will use Object.prototype.toString.call to check that the setting is the proper type.

If nullable is set to true, null will be a valid value as well.

Custom format checking

You can specify a custom format checking method on a property basis.

For example:

var config = convict({
  key: {
    doc: 'API key',
    format: function check (val) {
      if (!/^[a-fA-F0-9]{64}$/.test(val)) {
        throw new Error('must be a 64 character hex key')
      }
    },
    default: '3cec609c9bc601c047af917a544645c50caf8cd606806b4e0a23312441014deb'
  },
  name: {
    doc: 'user name',
    format: function check (val) {
      if (typeof val.first_name !== 'string') {
        throw new TypeError(`first name '${val.first_name}' is not a string`);
      }
      if (typeof val.last_name !== 'string') {
        throw new TypeError(`last name '${val.last_name}' is not a string`);
      }
    },
    default: {
      first_name: 'John',
      last_name: 'Doe'
    }
  }
});

Or, you can use convict.addFormat() to register a custom format checking method that can be reused for many different properties:

convict.addFormat({
  name: 'float-percent',
  validate: function(val) {
    if (val !== 0 && (!val || val > 1 || val < 0)) {
      throw new Error('must be a float between 0 and 1, inclusive');
    }
  },
  coerce: function(val) {
    return parseFloat(val, 10);
  }
});

var config = convict({
  space_used: {
    format: 'float-percent',
    default: 0.5
  },
  success_rate: {
    format: 'float-percent',
    default: 60.0
  }
});

The coerce function is optional.

Custom format for array items

You can specify a custom format checking for array items:

convict.addFormat({
  name: 'source-array',
  validate: function(sources, schema) {
    if (!Array.isArray(sources)) {
      throw new Error('must be of type Array');
    }

    for (source of sources) {
      convict(schema.children).load(source).validate();
    }
  }
});

convict.addFormat(require('convict-format-with-validator').url);

const schema = {
  sources: {
    doc: 'A collection of data sources.',
    format: 'source-array',
    default: [],

    children: {
      type: {
        doc: 'The source type',
        format: ['git', 'hg', 'svn'],
        default: null
      },
      url: {
        doc: 'The source URL',
        format: 'url',
        default: null
      }
    }
  }
};

convict(schema).load({
  'sources': [
    {
      'type': 'git',
      'url': 'https://github.com/mozilla/node-convict.git'
    },
    {
      'type': 'git',
      'url': 'https://github.com/github/hub.git'
    }
  ]
}).validate();

Coercion

Convict will automatically coerce environmental variables from strings to their proper types when importing them. For instance, values with the format int, nat, port, or Number will become numbers after a straight forward parseInt or parseFloat. duration and timestamp are also parse and converted into numbers, though they utilize moment.js for date parsing.

Precedence order

When merging configuration values from different sources, Convict follows precedence rules. The order, from lowest to highest, for config.loadFile(file) and config.load(json) is:

  1. Default value
  2. File or json set in function argument
  3. Environment variables (only used when env property is set in schema)
  4. Command line arguments (only used when arg property is set in schema)

This order means that if schema defines parameter to be taken from an environment variable and environment variable is set then you cannot override it with config.loadFile(file) or config.load(json).

process.env.PORT = 8080; // environment variable is set
const config = convict({
  port: {
    default: 3000,
    env: 'PORT'
  }
});
config.load({ port: 9000 });
console.log(config.get('port')); // still 8080 from env

Overriding Environment variables and Command line arguments

Convict allows to override Environment variables and Command line arguments. It can be helpful for testing purposes.

When creating a config object pass an object with two optional properties as the 2nd parameter:

  • env: Object - this object will be used instead of process.env
  • args: Array<string> - this array will be used instead of process.argv
var config = convict({
  // configuration schema
}, {
  env: {
    // Environment variables
  },
  args: [
    // Command line arguments
  ]
});

Configuration file additional types support

Convict is able to parse files with custom file types during loadFile. For this specify the corresponding parsers with the associated file extensions.

convict.addParser({ extension: 'toml', parse: toml.parse });
convict.addParser({ extension: ['yml', 'yaml'], parse: yaml.load });
convict.addParser([
  { extension: 'json', parse: JSON.parse },
  { extension: 'json5', parse: json5.parse },
  { extension: ['yml', 'yaml'], parse: yaml.load },
  { extension: 'toml', parse: toml.parse }
]);

const config = convict({ ... });
config.loadFile('config.toml');

If no supported extension is detected, loadFile will fallback to using the default json parser.

Allow comments in JSON files

If you want to allow comments in your JSON file, use JSON5.

convict.addParser({extension: 'json', parse: require('json5').parse});

API

var config = convict(schema[, opts])

convict() takes a schema object or a path to a schema JSON file and returns a convict configuration object.

opts: Optional object:

  • opts.env: Override process.env if specified using an object {'NODE_ENV': 'production'}.
  • opts.args: Override process.argv if specified using an array ['--argname', 'value'] or a string --argname value.

The configuration object has an API for getting and setting values, described below.

var config = convict({
  env: {
    doc: 'The application environment.',
    format: ['production', 'development', 'test'],
    default: 'development',
    env: 'NODE_ENV'
  },
  log_file_path: {
    'doc': 'Log file path',
    'format': String,
    'default': '/tmp/app.log'
  }
});

// or
config = convict('/some/path/to/a/config-schema.json');

convict.addParser(parser or parserArray)

Adds new parsers for custom file extensions

convict.addFormat(format) or convict.addFormat(name, validate, coerce)

Adds a new custom format, format being an object, see example below.

convict.addFormat({
  name: 'float-percent',
  validate: function(val) {
    if (val !== 0 && (!val || val > 1 || val < 0)) {
      throw new Error('must be a float between 0 and 1, inclusive');
    }
  },
  coerce: function(val) {
    return parseFloat(val, 10);
  }
});

convict.addFormats(formats)

Adds new custom formats, formats being an object whose keys are the new custom format names, see example below.

convict.addFormats({
  prime: {
    validate: function(val) {
      function isPrime(n) {
        if (n <= 1) return false; // zero and one are not prime
        for (let i=2; i*i <= n; i++) {
          if (n % i === 0) return false;
        }
        return true;
      }
      if (!isPrime(val)) throw new Error('must be a prime number');
    },
    coerce: function(val) {
      return parseInt(val, 10);
    }
  },
  'hex-string': {
    validate: function(val) {
      if (/^[0-9a-fA-F]+$/.test(val)) {
        throw new Error('must be a hexadecimal string');
      }
    }
  }
});

config.get(name)

Returns the current value of the name property. name can use dot notation to reference nested values. E.g.:

config.get('db.host');

// or
config.get('db').host;

config.default(name)

Returns the default value of the name property. name can use dot notation to reference nested values. E.g.:

config.default('server.port');

config.reset(name)

Resets a property to its default value as defined in the schema. E.g.:

config.reset('server.port');

config.has(name)

Returns true if the property name is defined, or false otherwise. E.g.:

if (config.has('some.property')) {
  // Do something
}

config.set(name, value)

Sets the value of name to value. name can use dot notation to reference nested values, e.g. "db.port". If objects in the chain don't yet exist, they will be initialized to empty objects. E.g.:

config.set('property.that.may.not.exist.yet', 'some value');
config.get('property.that.may.not.exist.yet');
// Returns "some value"

If you call config.load or config.loadFile after config.set then value provided by config.set will be overridden in case of conflict.

config.load(object)

Loads and merges a JavaScript object into config. E.g.:

config.load({
  'env': 'test',
  'ip': '127.0.0.1',
  'port': 80
});

config.loadFile(file or fileArray)

Loads and merges one or multiple JSON configuration files into config. E.g.:

config.loadFile('./config/' + conf.get('env') + '.json');

Or, loading multiple files at once:

// CONFIG_FILES=/path/to/production.json,/path/to/secrets.json,/path/to/sitespecific.json
config.loadFile(process.env.CONFIG_FILES.split(','));

config.validate([options])

Validates config against the schema used to initialize it. All errors are collected and thrown or displayed at once.

allowed option

  1. warn: If set to warn (that is {allowed: 'warn'} is passed), any properties specified in config files that are not declared in the schema will print a warning. This is the default behavior.

  2. strict: If set to strict (that is {allowed: 'strict'} is passed), any properties specified in config files that are not declared in the schema will throw errors. This is to ensure that the schema and the config files are in sync.

  3. output : You can replace the default output console.log by your own output function. You can use debug module like this:

      output: require('debug')('convict:validate:error')

config.getProperties()

Exports all the properties (that is the keys and their current values) as JSON.

config.toString()

Exports all the properties (that is the keys and their current values) as a JSON string, with sensitive values masked. Sensitive values are masked even if they aren't set, to avoid revealing any information.

config.getSchema()

Exports the schema as JSON.

config.getSchemaString()

Exports the schema as a JSON string.

config.getArgs()

The array of process arguments (not including the launcher and application file arguments). Defaults to process.argv unless an override is specified using the args key of the second (options) argument of the convict function.

config.getEnv()

The map of environment variables. Defaults to process.env unless an override is specified using the env key of the second argument (options) argument of the convict function.

FAQ

How can I define a configuration property as "required" without providing a default value?

The philosophy was to have production values be the default values. Usually you only want to change defaults for deploy or instance (in aws speak) specific tweaks. However, you can set a default value to null and if your format doesn't accept null it will throw an error.

How can I use convict in a (browserify-based) browser context?

Thanks to browserify, convict can be used for web applications too. To do so,

  • Use brfs to ensure the fs.loadFileSync schema-loading calls are inlined at build time rather than resolved at runtime (in Gulp, add .transform(brfs) to your browserify pipe).
  • To support "loading configuration from a http://foo.bar/some.json URL", build a thin wrapper around convict using your favorite http package (e.g. superagent). Typically, in the success callback, call convict's load() on the body of the response.

Migrating

changelog

Change Log

Automate your Workspace Versions, Changelogs & Publish with Lerna-Lite 🚀

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

6.2.4 (2023-01-07)

Bug Fixes

  • Fix imperfect prototype pollution fix (#410) (#411). Thanks to Captain-K-101

[6.2.3] - 2022-05-07

Fixed

  • More more complete fix for prototype pollution vulnerability first addressed in #384 (Marc-Aurèle Darche @madarche, Snyk Security team)

[6.2.2] - 2022-03-27

Fixed

  • More complete fix for prototype pollution vulnerability first addressed in

    384 (Marc-Aurèle Darche @madarche)

[6.2.1] - 2021-10-20

Fixed

  • Fix misspelling of the word optional in the error message #397 (Dan Allen @mojavelinux))

[6.2.0] - 2021-05-21

Changed

  • Update dependency: validator ^11.1.0^13.6.0 (#390)
  • Update dependency: parser ^18.1.3^20.2.7 (#390)
  • Update dependency: moment ^2.24.0^2.29.1 (#390)

[6.1.0] - 2021-05-03

Added

  • Add new "nullable" option to allow "null" additionally to any format #386 (maxwrlr)

[6.0.1] - 2021-03-11

Fixed

  • Fix prototype pollution vulnerability #384 (arjunshibu, Jamie Slome)

[6.0.0] - 2020-05-02

Changed

  • [BREAKING] Multi-packages split #327 (A-312, Marc-Aurèle Darche @madarche). There are now 3 packages: convict, convict-format-with-validator, convict-format-with-moment
  • [BREAKING] Remove the json5 dependency and make it an optional parser #326 (A-312)
  • Ease relying applications security fixes by using ^x.y.z range versions for Convict's dependencies and devDependencies, instead of exact/strict versions. Nowadays all applications should lock their dependencies and devDependencies using lock files such as package-lock.json. There is also tools such as npm audit fix that very easily and effectively fix vulnerabilites in version ranges. So, from now on, Convict will not put itself in the way, by leveraging Semantic Versioning to its maximum for dependencies and devDependencies. (Marc-Aurèle Darche @madarche)

Fixed

  • Fix multiple vulns by upgrading some deps (Cyrille Verrier @cyrille-arundo, Marc-Aurèle Darche @madarche)

[5.2.0] - 2019-10-12

Added

  • Add output preference for validate #301 (A-312)

Changed

  • Bump validator from 10.11.0 to 11.1.0 #316 (Tomasz Adamski @tmszdmsk)

Fixed

  • Fix vulns by upgrading some deps (eslint, mocha, coveralls) + npm audit fix (Marc-Aurèle Darche @madarche)
  • Doc: Fix typo and improve grammar and consistency in double-hyphen warning

    324 (Maya Vera @mayavera)

  • Doc: Fix link #308 (Brett Neese @brettneese)
  • Fix test on Windows #304 (A-312)

[5.1.0] - 2019-07-26

Added

  • Add context argument to custom format validate #296 (A-312)

[5.0.2] - 2019-07-26

Changed

  • Include only required validator functions #279 (Marcin K @chyzwar)

[5.0.1] - 2019-07-26

Fixed

  • Fix dev deps vulns by upgrading (nyc, coveralls) #295 (Marc-Aurèle Darche @madarche, A-312)

[5.0.0] - 2019-05-06

Changed

  • Drop long deprecated strict: true/strict: false option, which has been replaced by the allowed: 'strict/allowed: 'warn option (Marc-Aurèle Darche @madarche)
  • Update runtime deps (json5, moment, validator, yargs-parser) (Marc-Aurèle Darche @madarche)
  • Update dev deps (coveralls, eslint, js-yaml, mocha, toml) (Marc-Aurèle Darche @madarche)
  • Replaced dev deps (istanbul replaced by nyc, obj_diff replaced by deep-object-diff) (Marc-Aurèle Darche @madarche)
  • Drop Node.js < 6 support due to dep requirements (Marc-Aurèle Darche @madarche)

[4.4.1] - 2018-12-15

Fixed

  • Fix README for addFormats #268, #275 (Walter Rumsby @wrumsby, Sebastian Yandun @svyandun, Eray Hanoglu @erayhanoglu, Marc-Aurèle Darche @madarche)

Changed

  • Update deps (yargs-parser, validator) (Marc-Aurèle Darche @madarche)

[4.4.0] - 2018-09-22

Fixed

  • Fixed dot notation parsing by disabling dot-notation option in yarg-parser #269 (Patrick Shaw @PatrickShaw)

Added

  • Pass the name of the property being assigned to the custom coerce function #262 (Dan Allen @mojavelinux)

[4.3.2] - 2018-07-19

Fixed

[4.3.1] - 2018-06-07

Fixed

  • Handle loading empty files #257 (Paul Colleoni @polco)

[4.3.0] - 2018-06-02

Fixed

  • Allow argument value to be falsy #246 (Dan Allen @mojavelinux)

Added

  • Accept args and env as parameters to convict function #223 (Dan Allen @mojavelinux)
  • Allow the default parser to be set #248 (Dan Allen @mojavelinux)
  • Add package-lock.json file (Marc-Aurèle Darche @madarche)

Changed

  • Update deps (almost all) (Marc-Aurèle Darche @madarche)

Removed

  • Remove browserify package and configuration. This was never needed. (Marc-Aurèle Darche @madarche)

[4.2.0] - 2018-03-23

Added

  • Enhanced file formats support #244 (Tuan Nguyen @rocketspacer)

Changed

  • Fix doc (Marc-Aurèle Darche @madarche)

[4.1.0] - 2018-03-15

Changed

  • Make warnings more visible by coloring them #242 (Nawfel @NawfelBgh)

Fixed

  • Fix custom format object nested properties warning by checking for the item type instead of item format #234 (Helias Criouet @Helias-Criouet)
  • Fix README on how cli args work #226 (Ian Chadwick @ianchadwick)

[4.0.2] - 2017-11-30

Security

  • Update moment to fixed security version #231 (Marc-Aurèle Darche @madarche)

[4.0.1] - 2017-09-17

Changed

  • Update dependencies #220 (Marc-Aurèle Darche @madarche)
  • Move away from minimist to yargs-parser #219 (Marc-Aurèle Darche @madarche)
  • Corrected a typo #218 (Nikolay Govorov @nikolay-govorov)
  • Fix issue with empty string over default not null value #217 (Jonathan Petitcolas @jpetitcolas)
  • Ensure property defaults are not modified #216 (Eli Young @elyscape)
  • Nested props in 'object' values are not undeclared #215 (Michael McGahan @mmcgahan)

[4.0.0] - 2017-06-22

Added

  • Handle shorthand for default empty objects #194 (Eli Young @elyscape)
  • 100% test coverage #192 (Eli Young @elyscape)
  • Include static tests in code coverage checks #191 (Eli Young @elyscape)
  • Add support for masking sensitive values #190 (Eli Young @elyscape)
  • Support mapping env vars to multiple settings #189 (Richard Marmorstein @twitchard)

Changed

  • Rework validate() to check for overridden parent #206 (Eli Young @elyscape)
  • Document that a JSON/JSON5 schema file can be used #198 (Marc-Aurèle Darche @madarche)
  • Better advertize CLI tests as such #197 (Marc-Aurèle Darche @madarche)
  • Support arbitrary casing of booleans #195 (Eli Young @elyscape)

Removed

  • Remove the npm-shrinkwrap.json file #210 (Marc-Aurèle Darche @madarche)

Fixed

  • Fix documentation for config.loadFile() #207 (Eli Young @elyscape)
  • Tests env/arg type coercion and fix arg number coercion #199 (Eli Young @elyscape)
  • Make schema objects actually useful #196 (Eli Young @elyscape)

[3.0.0] - 2017-03-16

Added

  • In validate function alter option strict to allowed, with option values strict and warn #182 (@benTrust)

Changed

  • Rename pipe formats to emphasize that they are for windows pipes #179 (Gurpreet Atwal @gurpreetatwal)
  • Update dependencies #184 (Marc-Aurèle Darche @madarche)

[2.0.0] - 2016-12-18

  • Named Pipe Support #175 (Gurpreet Atwal @gurpreetatwal)
  • Stop supporting Node.js 0.12 by december 2016 #166 (Marc-Aurèle Darche @madarche)
  • Stop supporting Node.js 0.10 by october 2016 #164 (Marc-Aurèle Darche @madarche)
  • Remove deprecated methods root and toSchemaString
  • Deps: validator@6.2.0
  • Deps: moment@2.17.1
  • Deps: json5@0.5.1
  • devDeps: all up-to-date

[1.5.0] - 2016-09-28

  • Add RegExp format #165 (@philbooth)

[1.4.0] - 2016-05-29

  • Add new reset method #148 (Marc-Aurèle Darche @madarche)
  • Replace optimist which is deprecated #154 (Brian Vanderbusch @LongLiveCHIEF)
  • Move varify to optionalDependencies #153 (@mlucool)

[1.3.0] - 2016-04-07

  • Replace cjson with json5 (@ratson)
  • Fix missing npm-shrinkwrap.json file in published NPM module

[1.2.0] - 2016-04-01

  • Support for built-in formats in schema files #138 (Hem Brahmbhatt @damnhipster)
  • Improve stability and security: Use shrinkwrap to lock module dependencies #139 (Marc-Aurèle Darche @madarche)
  • devDeps: coveralls@2.11.9 to stay in sync
  • devDeps: eslint@2.5.3 to stay in sync

[1.1.3] - 2016-03-18

[1.1.2] - 2016-02-12

  • Documentation and management script fixes; no code changes.

[1.1.1] - 2016-02-05

[1.1.0] - 2016-02-02

  • Fix loading consecutive files could cause an error to be thrown #111 (Abdullah Ali @voodooattack)
  • Coerce values loaded from a file #96 (Jens Olsson @jsol)
  • Improvement: Pass instance to coerce #109 (Abdullah Ali @voodooattack)
  • Fix missing return in validate reducer #101 (Kris Reeves @myndzi)
  • Deps: moment
  • Deps: validator
  • Switch back from Blanket to Istanbul for test coverage (Marc-Aurèle Darche @madarche)
  • Stricter JSLint linting (Marc-Aurèle Darche @madarche)
  • Improve documentation (Olivier Lalonde @olalonde, Marc-Aurèle Darche @madarche)

[1.0.2] - 2015-12-09

  • Merge pull request #97 from yoz/cjson-0.3.2 Update cjson dependency to 0.3.2
  • Update cjson dependency to 0.3.2 This removes the transitive dependency on 'jsonlint' (in favor of json-parse-helpfulerror), which avoids its problems with unstated dependencies on 'file' and 'system'.
  • Coerce values loaded from a file Previously values were coerced if added through set(), command line arguments or env arguments. Added the schema to the recursive overlay function so that values added through load() and loadFile() are also coerced. Corrected a test to reflect this.
  • Deps: update all
  • Switch from JSHint to ESLint

[1.0.1] - 2015-08-11

  • Merge pull request #87 from mozilla/rfk/duration-integer-string Accept integer millisecond durations in string form, e.g. from env vars.
  • Accept integer millisecond durations in string form, e.g. from env vars.

[1.0.0] - 2015-08-01

  • Merge pull request #85 from madarche/feat-1.0 v1.0.0 and remove old deprecated formats ipv4 and ipv6
  • Better wording for validate options
  • Consistency using periods
  • Improve feature description again
  • Improved features description
  • Better config.validate([options]) doc + beautify
  • Update dependencies
  • Merge branch 'feat-update-dependencies' into feat-1.0
  • v1.0.0 Remove old deprecated formats ipv4 and ipv6

[0.8.2] - 2015-07-20

  • Merge pull request #84 from madarche/feat-update-deps Update dependencies
  • Update dependencies

[0.8.1] - 2015-07-20

  • Merge pull request #82 from myndzi/fix-license Update package.json 'license' key format
  • Merge pull request #83 from madarche/feat-get-properties Document and test properties and schema export
  • Document and test properties and schema export This modification also renames the previously undocumented and untested following methods:
    • root→getProperties and
    • toSchemaString→getSchemaString The renaming was done for clearer intent and consistency in naming. The previous method names are still supported but deprecated.
  • Update package.json 'license' key format
  • Merge pull request #80 from madarche/fix-nested-schema-doc Document nested settings in schema
  • Merge pull request #79 from madarche/fix-doc Document new strict validation mode
  • Document nested settings in schema Fixes #78
  • Document new strict validation mode Fixes #75
  • Merge pull request #77 from madarche/fix-test_coverage Fix test coverage
  • Fix test coverage The rationale in this change is to put logic as less as possible in .travis.yml since it's not testable on developers' system.
  • Merge pull request #76 from madarche/feat-update_dependencies Update dependencies
  • Merge pull request #74 from mmerkes/master Fixes #73, removes validator.check from README.md and adds valid form…
  • Update dependencies
  • Adds convict.addFormat() to validation section of README and tidies up section
  • Fixes #73, removes validator.check from README.md and adds valid format checker

[0.8.0] - 2015-05-31

  • Merge pull request #64 from umar-muneer/master Strict Validation Mode Added
  • Merge pull request #72 from pdehaan/patch-2 Fix typos in README
  • Fix typos in README

[0.7.0] - 2015-04-29

  • Merge pull request #66 from collinwat/add-format-overload addFormat supports object arguments as well as function arguments
  • Merge pull request #70 from madarche/fix-update-deps Update dependencies and removed should replaced
  • Merge pull request #69 from madarche/feat-new-nodejs-0.12 Make CI test Node.js 0.12, the new stable
  • Update dependencies and removed should replaced should has been replaced by js-must.
  • Make CI test Node.js 0.12, the new stable
  • Merge pull request #61 from ronjouch/browserifyTransformVarify Add 'varify' browserify transform to support IE9,10
  • Add format supports object arguments as well as function arguments
  • Merge pull request #62 from madjid04/master Add code coverage with blanket
  • Strict Validation Mode
    1. Added a fix for nested validation checks.
    2. Modified test case schema and config files.
  • Strict Validation Mode Added
    1. Added a Strict Validation mode. If set to true, any properties specified in config files that are not declared in the schema will result in errors. This is to ensure that the schema and the config files are in sync. This brings convict further in line with the concept of a “Schema”. By default the strict mode is set to false.
    2. Added test cases for strict mode
  • modification of the indentation

[0.6.1] - 2015-01-12

  • Fix duration check #54
  • Update dependencies #48
  • Use js-must a safer test assertion library #49

[0.6.0] - 2014-11-14

  • Update dependencies (including latest validator) #46
  • Deprecate "ipv4" and "ipv6" formats

[0.5.1] - 2014-10-29

  • Update dependencies
  • Use fix versions everywhere for safe validation
  • More readable date for test #43

[0.5.0] - 2014-10-15

  • Fix npmignore anything that's not needed for production #38
  • Fix The schema get modified by convict #37
  • npm ignore things
  • JSHint lint + 80 cols formatting #39

[0.4.3] - 2014-10-13

  • Test the correct convict object for the undefined attribute #31
  • Update moment.js to 2.6.0 #36

[0.4.2] - 2014-01-12

  • Update cjson 0.2.1 —> 0.3.0
  • Coerce 'nat' formatted values #26
  • Update canonical package.json URLs #24
  • Fix 'should handle timestamp' failing test #21
  • Update package.json #43
  • Add license info
    • Update Dependency #18

[0.4.1] - 2013-10-14

  • Support JSON formatted objects in env

[0.4.0] - 2013-07-31

[0.3.3] - 2013-06-18

[0.3.1] - 2013-06-04

[0.3.0] - 2013-06-03

[0.2.3] - 2013-05-27

[0.2.2] - 2013-05-25

[0.2.1] - 2013-05-25

[0.2.0] - 2013-05-23

[0.1.1] - 2013-05-19

[0.1.0] - 2013-03-05

Initial release