Socket
Socket
Sign inDemoInstall

@ipdigital/config-loader

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ipdigital/config-loader

Loads your default configuration and environment specific configuration into global.config


Version published
Weekly downloads
2
Maintainers
1
Install size
16.2 kB
Created
Weekly downloads
 

Readme

Source

Config Loader

config-loader, loads your configuration variables for multiple environments.
It allows for more flexibility than using the environment variables due to the support of nested objects.

How it works

config-loader will look for env/default.js in your application's root folder.
Add all the possible variables here and set the default values.
Then it will load env/local.js, continued by env/finally.js. In finally.js you can define some methods to create config variables from previously loaded variables. Config variables are deep-merged and later variables overwrite earlier existing ones.

So default: { a: 0, b: 2 } and local: { a: 1, c: 3 } becomes { a: 1, b: 2, c: 3 }

Install

$ npm install --save env-loader

Usage

require('config-loader');

Config file format

module.exports = {
  "SOME_VAR": "define here",

  "OBJECT": {
	"a": 1,
	"b": 2
  }
};

Example for finally

function manipulate() {
  global.config.url = global.config.host + '/' + global.config.path;
}
module.export = manipulate();

FAQs

Last updated on 11 Nov 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