Socket
Socket
Sign inDemoInstall

painless-config-as-code

Package Overview
Dependencies
4
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    painless-config-as-code

A configuration-as-code resolver for environment variables


Version published
Weekly downloads
8
increased by700%
Maintainers
2
Install size
85.9 kB
Created
Weekly downloads
 

Readme

Source

painless-config-as-code

Environment variable resolution using configuration-as-code logic on top of painless-config. For Node.js apps.

Environment value resolution

ordertypeprovider of valuenotes
1process env variablepainless-configprocess.env in node
2env.json file valuepainless-configwill walk up the directory hierarchy until finding an env.json
3env.json file valpainless-config-as-codewill look for an ./env/env.json, such as ./env/prod.json
4env packagenpm packagepackage defined in package.json or ENVIRONMENT_MODULES_NAME

How to use the library

const painlessConfigAsCode = require('painless-config-as-code');
const someValue = painlessConfigAsCode.get('SOME_VALUE');

Unofficial but useful

This component was developed by the Open Source Programs Office at Microsoft. The OSPO team uses Node.js for some of its applications and has found this component to be useful. We are sharing this in the hope that others may find it useful.

It's important to understand that this library was developed for use by a team at Microsoft, but that this is not an official library or module built by the KeyVault team.

Other Node configuration libraries

There are many other configuration libraries for Node, but of course everyone has their own favorite. Consider one of these if you'd like a more fully supported library.

This library is most like node-config, with the difference being that it is limited to just JSON files at this time for values, and its use of painless-config to resolve environment variables or other configuration values located up the directory hierarchy.

In deciding to build this library many other libraries were considered.

License

MIT

Contributing

Pull requests will gladly be considered! A CLA may be needed.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Changes

0.0.2

  • Adds support for environment-containing npm package(s)
    • Multiple packages are supported, with the first package values winning
    • Packages can be defined in an app's package.json as well as environment variables such as ENVIRONMENT_MODULES
    • Environment-variable based package names have higher precedence than package.json-based
  • Can be required without calling as a function when no custom initialization options are needed
  • The environment directory name can now be configured via the ENVIRONMENT_DIRECTORY key (and also ENVIRONMENT_DIRECTORY_KEY to change that variable name)
  • The variable keys used to define the configuration environment can now be customized via CONFIGURATION_ENVIRONMENT_KEYS

0.0.1

  • Initial release

Keywords

FAQs

Last updated on 03 Mar 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc