2.1.3 • Published 5 years ago

@codecat/config v2.1.3

Weekly downloads
8
License
MIT
Repository
-
Last release
5 years ago

@codecat/config

Configuration handling for projects.

Features

  • Ability to load nested config files
  • Ability to put ENV variables to in JSON and YAML
  • Validation of loaded config file with use of @hapi/joi
  • Resolving paths relative to config files

Usage

configFile.yml

port: 9000

app.js

const ConfigLoader = require('@codecat/config');
const Joi = require('@hapi/joi');

const schema = Joi.object().keys({
  port: Joi.number().port().default(8000)
});

const config = ConfigLoader(schema).load('./configFile.yml');

console.log(config.port); // 9000

Currently YAML, JSON and JS files are supported.

TODO

ability to add more file loaders for different mime-types
ability to define custom directives
write some more info in README

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago