# one-json-config

> Way to write less configs for multiple envs

Latest version **0.0.9** (published 2017-12-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install one-json-config
pnpm add one-json-config
yarn add one-json-config
bun add one-json-config
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2017-12-28 |
| First published | 2015-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dmitriy Kharchenko |
| Maintainers | dmitriykharchenko |
| Keywords | config, json |

## Links

- npm: https://www.npmjs.com/package/one-json-config
- Repository: https://github.com/dmitriykharchenko/one-json-config
- Homepage: https://github.com/dmitriykharchenko/one-json-config#readme
- Issues: https://github.com/dmitriykharchenko/one-json-config/issues
- npm.io page: https://npm.io/package/one-json-config

## Dependencies (1)

- [is-plain-object](https://npm.io/package/is-plain-object.md) ^2.0.4

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.9 (latest) — 2017-12-28
- 0.0.8 — 2017-12-28
- 0.0.7 — 2017-12-28
- 0.0.6 — 2017-12-28
- 0.0.5 — 2015-12-30
- 0.0.4 — 2015-12-30
- 0.0.3 — 2015-12-29
- 0.0.2 — 2015-12-12
- 0.0.1 — 2015-12-12

## README

# one-json-config

Allows to have one config.json for all your envs.
Tested on node v9

Give it config json like that:

```javascript
{
  "key": "value",
  "otherKey.prod": "otherProd",
  "otherKey.dev": "otherDev"
}
```

for production it will be like:

```javascript
{
  "key": "value",
  "otherKey": "otherProd"
}
```

And for development:

```javascript
{
  "key": "value",
  "otherKey": "otherDev"
}
```


### API

`oneJsonConfig(config, currentEnvName, allowedEnvs)`

Example:

```javascript
import oneJsonConfig from 'one-json-config'
import config from '../some/path/to/config/json'

const env = process.env.NODE_ENV

export default oneJsonConfig(config, env, ['development', 'production'])


```

`allowedEnvs` can be also specified in `config.json` by key `__envs__`:

```javascript
import oneJsonConfig from 'one-json-config'

config = {
  "__envs__": ["development", "production"],
  "key": "value",
  "otherKey.prod": "otherProd",
  "otherKey.dev": "otherDev"
}

export default oneJsonConfig(config, process.env.NODE_ENV);


```

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