0.0.9 • Published 6 years ago

one-json-config v0.0.9

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

one-json-config

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

Give it config json like that:

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

for production it will be like:

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

And for development:

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

API

oneJsonConfig(config, currentEnvName, allowedEnvs)

Example:

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__:

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);
0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago