1.0.10 • Published 9 years ago

plus.config v1.0.10

Weekly downloads
8
License
BSD
Repository
bitbucket
Last release
9 years ago

plus.config - configuration with environment

This config based on nconf and config packages and loads configuration from folder. It has 2 parameters dir and env.

Loading environment

Dir structure

|-- config.json
|-- config_dev.json
|-- config_test.json
|-- config_prod.json
`-- parameters.json
    var Config = require('plus.config');

    var config = new Config({
        dir: __dirname,
        env: process.env.NODE_ENV || 'dev'
    });

    config.get('var-name')
    config.get('deep.to.var-name')

This code loads config.json overrides variables with config_dev.json and overrides variables parameters.json. It works recursively.

It loads:

  • config.json // common settings
  • config_dev.json // environment settings
  • parameters.json // custom settings for local environment

Using

NODE_ENV=test node app.js

if you use test environment it will loads files in this order:

  • config.json // common settings
  • config_test.json // environment settings
  • parameters.json // custom settings for local environment

Config support

Now plus.config supports files in this format to this based on config package https://www.npmjs.com/package/config

default.EXT
default-{instance}.EXT
{deployment}.EXT
{deployment}-{instance}.EXT
{short_hostname}.EXT
{short_hostname}-{instance}.EXT
{short_hostname}-{deployment}.EXT
{short_hostname}-{deployment}-{instance}.EXT
{full_hostname}.EXT
{full_hostname}-{instance}.EXT
{full_hostname}-{deployment}.EXT
{full_hostname}-{deployment}-{instance}.EXT
local.EXT
local-{instance}.EXT
local-{deployment}.EXT
local-{deployment}-{instance}.EXT
1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago