# plus.config

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

Latest version **1.0.10** (published 2015-11-05) · BSD license · 0 weekly downloads

## Install

```sh
npm install plus.config
pnpm add plus.config
yarn add plus.config
bun add plus.config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2015-11-05 |
| First published | 2014-05-08 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+10 in 3 direct dependencies) |
| Install scripts | no |
| Author | slava hatnuke |
| Maintainers | slava.hatnuke |

## Links

- npm: https://www.npmjs.com/package/plus.config
- Repository: https://bitbucket.org/slavahatnuke/plus.config
- npm.io page: https://npm.io/package/plus.config

## Dependencies (4)

- [merge](https://npm.io/package/merge.md) 1.1.3
- [nconf](https://npm.io/package/nconf.md) 0.6.9
- [config](https://npm.io/package/config.md) 1.16.0
- [js-yaml](https://npm.io/package/js-yaml.md) 3.3.1

## Recent versions

- 1.0.10 (latest) — 2015-11-05
- 1.0.9 — 2015-08-19
- 1.0.8 — 2014-11-26
- 1.0.7 — 2014-11-26
- 1.0.6 — 2014-11-26
- 1.0.5 — 2014-09-19
- 1.0.4 — 2014-09-02
- 1.0.3 — 2014-09-02
- 1.0.2 — 2014-09-02
- 1.0.1 — 2014-09-02
- 1.0.0 — 2014-05-08

## README

# 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
```

---
_Source: https://npm.io/package/plus.config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
