Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

one-json-config

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

one-json-config

Way to write less configs for multiple envs

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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


Keywords

FAQs

Package last updated on 28 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc