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

config

Package Overview
Dependencies
Maintainers
2
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config - npm Package Compare versions

Comparing version 3.3.7 to 3.3.8

12

History.md

@@ -5,3 +5,3 @@ 3.3.7 / 2022-01-11

* No new changes. 3.3.6 was not published to NPM in versioning mix-up.
* Release notes are moving to Github Releas page going forward.
* Release notes are moving to Github Releases page going forward.

@@ -16,3 +16,3 @@ 3.3.6 / 2021-03-08

* FIX [#628](https://github.com/lorenwest/node-config/issues/628) Uncaught ReferenceError: node_env_var_name is not defined @prnake
* FIX [#628](https://github.com/node-config/node-config/issues/628) Uncaught ReferenceError: node_env_var_name is not defined @prnake

@@ -349,3 +349,3 @@ 3.3.4 / 2021-02-26

* new defer sub-module introduced in 1.8.0 can now be accessed by require('config/defer')
For usage, see: https://github.com/lorenwest/node-config/wiki/Configuration-Files#javascript-module---js
For usage, see: https://github.com/node-config/node-config/wiki/Configuration-Files#javascript-module---js
* Add test coverage for array merging cases. (@markstos)

@@ -358,3 +358,3 @@ * Bump dependency on cson package to 1.6.1 (@markstos)

* Added deferred function for evaluating configs after load (@markstos)
For details, see: https://github.com/lorenwest/node-config/wiki/Configuration-Files#javascript-module---js
For details, see: https://github.com/node-config/node-config/wiki/Configuration-Files#javascript-module---js
* Bumped js-yaml dependency (@markstos)

@@ -444,3 +444,3 @@

* Major revision. Upgrade notes:
https://github.com/lorenwest/node-config/wiki/Upgrading-From-Config-0.x
https://github.com/node-config/node-config/wiki/Upgrading-From-Config-0.x
* Update to semver versioning

@@ -464,3 +464,3 @@ * Change load ordering

* Added SUPPRESS_NO_CONFIG_WARNING for better sub-module support
* Moved all documentation [to the wiki](https://github.com/lorenwest/node-config/wiki).
* Moved all documentation [to the wiki](https://github.com/node-config/node-config/wiki).

@@ -467,0 +467,0 @@ 0.4.37 / 2014-07-22

@@ -1,2 +0,2 @@

// config.js (c) 2010-2020 Loren West and other contributors
// config.js (c) 2010-2022 Loren West and other contributors
// May be freely distributed under the MIT license.

@@ -7,4 +7,3 @@ // For further details and documentation:

// Dependencies
var deferConfig = require('../defer').deferConfig,
DeferredConfig = require('../defer').DeferredConfig,
var DeferredConfig = require('../defer').DeferredConfig,
RawConfig = require('../raw').RawConfig,

@@ -18,8 +17,6 @@ Parser = require('../parser'),

var DEFAULT_CLONE_DEPTH = 20,
NODE_CONFIG, CONFIG_DIR, RUNTIME_JSON_FILENAME, NODE_ENV, APP_INSTANCE,
HOST, HOSTNAME, ALLOW_CONFIG_MUTATIONS, CONFIG_SKIP_GITCRYPT, NODE_ENV_VAR_NAME,
CONFIG_DIR, NODE_ENV, APP_INSTANCE,
CONFIG_SKIP_GITCRYPT, NODE_ENV_VAR_NAME,
NODE_CONFIG_PARSER,
env = {},
privateUtil = {},
deprecationWarnings = {},
configSources = [], // Configuration sources - array of {name, original, parsed}

@@ -415,2 +412,15 @@ checkMutability = true, // Check for mutability/immutability on first get

} else {
// Call recursively if an object.
if (util.isObject(value)) {
// Create a proxy, to capture user updates of configuration options, and throw an exception for awareness, as per:
// https://github.com/lorenwest/node-config/issues/514
value = new Proxy(util.makeImmutable(value), {
set (target, name) {
const message = (Reflect.has(target, name) ? 'update' : 'add');
// Notify the user.
throw Error(`Can not ${message} runtime configuration property: "${name}". Configuration objects are immutable unless ALLOW_CONFIG_MUTATIONS is set.`)
}
})
}
Object.defineProperty(object, propertyName, {

@@ -422,9 +432,5 @@ value: value,

// Ensure new properties can not be added.
Object.preventExtensions(object)
// Call recursively if an object.
if (util.isObject(value)) {
util.makeImmutable(value);
}
// Ensure new properties can not be added, as per:
// https://github.com/lorenwest/node-config/issues/505
Object.preventExtensions(object[propertyName])
}

@@ -569,14 +575,10 @@ }

CONFIG_DIR = configDir || util.initParam('NODE_CONFIG_DIR', Path.join( process.cwd(), 'config') );
if (CONFIG_DIR.indexOf('.') === 0) {
CONFIG_DIR = Path.join(process.cwd() , CONFIG_DIR);
}
var dir = configDir || util.initParam('NODE_CONFIG_DIR', Path.join( process.cwd(), 'config') );
dir = _toAbsolutePath(dir);
APP_INSTANCE = util.initParam('NODE_APP_INSTANCE');
HOST = util.initParam('HOST');
HOSTNAME = util.initParam('HOSTNAME');
CONFIG_SKIP_GITCRYPT = util.initParam('CONFIG_SKIP_GITCRYPT');
// This is for backward compatibility
RUNTIME_JSON_FILENAME = util.initParam('NODE_CONFIG_RUNTIME_JSON', Path.join(CONFIG_DIR , 'runtime.json') );
var runtimeFilename = util.initParam('NODE_CONFIG_RUNTIME_JSON', Path.join(dir , 'runtime.json') );

@@ -588,3 +590,3 @@ NODE_CONFIG_PARSER = util.initParam('NODE_CONFIG_PARSER');

? NODE_CONFIG_PARSER
: Path.join(CONFIG_DIR, NODE_CONFIG_PARSER);
: Path.join(dir, NODE_CONFIG_PARSER);
Parser = require(parserModule);

@@ -598,2 +600,5 @@ }

var HOST = util.initParam('HOST');
var HOSTNAME = util.initParam('HOSTNAME');
// Determine the host name from the OS module, $HOST, or $HOSTNAME

@@ -649,3 +654,3 @@ // Remove any . appendages, and default to null if not set

var locatedFiles = util.locateMatchingFiles(CONFIG_DIR, allowedFiles);
var locatedFiles = util.locateMatchingFiles(dir, allowedFiles);
locatedFiles.forEach(function(fullFilename) {

@@ -662,2 +667,5 @@ var configObj = util.parseFile(fullFilename, options);

var envConfig = {};
CONFIG_DIR = dir;
if (process.env.NODE_CONFIG) {

@@ -702,7 +710,7 @@ try {

// Override with environment variables if there is a custom-environment-variables.EXT mapping file
var customEnvVars = util.getCustomEnvVars(CONFIG_DIR, extNames);
var customEnvVars = util.getCustomEnvVars(dir, extNames);
util.extendDeep(config, customEnvVars);
// Extend the original config with the contents of runtime.json (backwards compatibility)
var runtimeJson = util.parseFile(RUNTIME_JSON_FILENAME) || {};
var runtimeJson = util.parseFile(runtimeFilename) || {};
util.extendDeep(config, runtimeJson);

@@ -731,2 +739,3 @@

if (configDir) {
configDir = _toAbsolutePath(configDir);
try {

@@ -1132,7 +1141,7 @@ FileSystem.readdirSync(configDir).forEach(function(file) {

* @method getCustomEnvVars
* @param CONFIG_DIR {string} - the passed configuration directory
* @param configDir {string} - the passed configuration directory
* @param extNames {Array[string]} - acceptable configuration file extension names.
* @returns {object} - mapped environment variables or {} if there are none
*/
util.getCustomEnvVars = function (CONFIG_DIR, extNames) {
util.getCustomEnvVars = function (configDir, extNames) {
var result = {};

@@ -1144,3 +1153,3 @@ var resolutionIndex = 1;

});
var locatedFiles = util.locateMatchingFiles(CONFIG_DIR, allowedFiles);
var locatedFiles = util.locateMatchingFiles(configDir, allowedFiles);
locatedFiles.forEach(function (fullFilename) {

@@ -1492,3 +1501,3 @@ var configObj = util.parseFile(fullFilename);

var prefix = beStrict ? 'FATAL: ' : 'WARNING: ';
var seeURL = 'See https://github.com/lorenwest/node-config/wiki/Strict-Mode';
var seeURL = 'See https://github.com/node-config/node-config/wiki/Strict-Mode';

@@ -1505,2 +1514,11 @@ console.error(prefix+msg);

// Helper functions shared accross object members
function _toAbsolutePath (configDir) {
if (configDir.indexOf('.') === 0) {
return Path.join(process.cwd(), configDir);
}
return configDir;
}
// Instantiate and export the configuration

@@ -1507,0 +1525,0 @@ var config = module.exports = new Config();

{
"name": "config",
"version": "3.3.7",
"version": "3.3.8",
"main": "./lib/config.js",
"description": "Configuration control for production node deployments",
"author": "Loren West <open_source@lorenwest.com>",
"homepage": "http://github.com/lorenwest/node-config.git",
"homepage": "http://github.com/node-config/node-config.git",
"publishConfig": {

@@ -25,3 +25,3 @@ "registry": "https://registry.npmjs.org/"

"dependencies": {
"json5": "^2.1.1"
"json5": "^2.2.1"
},

@@ -45,3 +45,3 @@ "devDependencies": {

"type": "git",
"url": "http://github.com/lorenwest/node-config.git"
"url": "http://github.com/node-config/node-config.git"
},

@@ -48,0 +48,0 @@ "engines": {

@@ -66,3 +66,3 @@ // External libraries are lazy-loaded only if these file types exist.

// Imports config if it is exported via module.exports = ...
// See https://github.com/lorenwest/node-config/issues/524
// See https://github.com/node-config/node-config/issues/524
var configObject = require(filename);

@@ -69,0 +69,0 @@

@@ -5,4 +5,4 @@ Configure your Node.js Applications

[![NPM](https://nodei.co/npm/config.svg?downloads=true&downloadRank=true)](https://nodei.co/npm/config/)&nbsp;&nbsp;
[![Build Status](https://secure.travis-ci.org/lorenwest/node-config.svg?branch=master)](https://travis-ci.org/lorenwest/node-config)&nbsp;&nbsp;
[release notes](https://github.com/lorenwest/node-config/blob/master/History.md)
[![Build Status](https://secure.travis-ci.org/node-config/node-config.svg?branch=master)](https://travis-ci.org/lorenwest/node-config)&nbsp;&nbsp;
[release notes](https://github.com/node-config/node-config/blob/master/History.md)

@@ -18,4 +18,4 @@ Introduction

Configurations are stored in [configuration files](https://github.com/lorenwest/node-config/wiki/Configuration-Files) within your application, and can be overridden and extended by [environment variables](https://github.com/lorenwest/node-config/wiki/Environment-Variables),
[command line parameters](https://github.com/lorenwest/node-config/wiki/Command-Line-Overrides), or [external sources](https://github.com/lorenwest/node-config/wiki/Configuring-from-an-External-Source).
Configurations are stored in [configuration files](https://github.com/node-config/node-config/wiki/Configuration-Files) within your application, and can be overridden and extended by [environment variables](https://github.com/lorenwest/node-config/wiki/Environment-Variables),
[command line parameters](https://github.com/node-config/node-config/wiki/Command-Line-Overrides), or [external sources](https://github.com/lorenwest/node-config/wiki/Configuring-from-an-External-Source).

@@ -36,3 +36,3 @@ This gives your application a consistent configuration interface shared among a

---------------
The following examples are in JSON format, but configurations can be in other [file formats](https://github.com/lorenwest/node-config/wiki/Configuration-Files#file-formats).
The following examples are in JSON format, but configurations can be in other [file formats](https://github.com/node-config/node-config/wiki/Configuration-Files#file-formats).

@@ -114,17 +114,17 @@ **Install in your app directory, and edit the default config file.**

* [Configuration Files](https://github.com/lorenwest/node-config/wiki/Configuration-Files)
* [Special features for JavaScript configuration files](https://github.com/lorenwest/node-config/wiki/Special-features-for-JavaScript-configuration-files)
* [Common Usage](https://github.com/lorenwest/node-config/wiki/Common-Usage)
* [Environment Variables](https://github.com/lorenwest/node-config/wiki/Environment-Variables)
* [Reserved Words](https://github.com/lorenwest/node-config/wiki/Reserved-Words)
* [Command Line Overrides](https://github.com/lorenwest/node-config/wiki/Command-Line-Overrides)
* [Multiple Node Instances](https://github.com/lorenwest/node-config/wiki/Multiple-Node-Instances)
* [Sub-Module Configuration](https://github.com/lorenwest/node-config/wiki/Sub-Module-Configuration)
* [Configuring from a DB / External Source](https://github.com/lorenwest/node-config/wiki/Configuring-from-an-External-Source)
* [Securing Production Config Files](https://github.com/lorenwest/node-config/wiki/Securing-Production-Config-Files)
* [External Configuration Management Tools](https://github.com/lorenwest/node-config/wiki/External-Configuration-Management-Tools)
* [Examining Configuration Sources](https://github.com/lorenwest/node-config/wiki/Examining-Configuration-Sources)
* [Using Config Utilities](https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities)
* [Upgrading from Config 0.x](https://github.com/lorenwest/node-config/wiki/Upgrading-From-Config-0.x)
* [Webpack usage](https://github.com/lorenwest/node-config/wiki/Webpack-Usage)
* [Configuration Files](https://github.com/node-config/node-config/wiki/Configuration-Files)
* [Special features for JavaScript configuration files](https://github.com/node-config/node-config/wiki/Special-features-for-JavaScript-configuration-files)
* [Common Usage](https://github.com/node-config/node-config/wiki/Common-Usage)
* [Environment Variables](https://github.com/node-config/node-config/wiki/Environment-Variables)
* [Reserved Words](https://github.com/node-config/node-config/wiki/Reserved-Words)
* [Command Line Overrides](https://github.com/node-config/node-config/wiki/Command-Line-Overrides)
* [Multiple Node Instances](https://github.com/node-config/node-config/wiki/Multiple-Node-Instances)
* [Sub-Module Configuration](https://github.com/node-config/node-config/wiki/Sub-Module-Configuration)
* [Configuring from a DB / External Source](https://github.com/node-config/node-config/wiki/Configuring-from-an-External-Source)
* [Securing Production Config Files](https://github.com/node-config/node-config/wiki/Securing-Production-Config-Files)
* [External Configuration Management Tools](https://github.com/node-config/node-config/wiki/External-Configuration-Management-Tools)
* [Examining Configuration Sources](https://github.com/node-config/node-config/wiki/Examining-Configuration-Sources)
* [Using Config Utilities](https://github.com/node-config/node-config/wiki/Using-Config-Utilities)
* [Upgrading from Config 0.x](https://github.com/node-config/node-config/wiki/Upgrading-From-Config-0.x)
* [Webpack usage](https://github.com/node-config/node-config/wiki/Webpack-Usage)

@@ -135,5 +135,5 @@ Further Information

* The [wiki may have more pages](https://github.com/lorenwest/node-config/wiki) which are not directly linked from here.
* The [wiki may have more pages](https://github.com/node-config/node-config/wiki) which are not directly linked from here.
* Review [questions tagged with node-config](https://stackexchange.com/filters/207096/node-config) on StackExchange. These are monitored by `node-config` contributors.
* [Search the issue tracker](https://github.com/lorenwest/node-config/issues). Hundreds of issues have already been discussed and resolved there.
* [Search the issue tracker](https://github.com/node-config/node-config/issues). Hundreds of issues have already been discussed and resolved there.

@@ -177,6 +177,6 @@ Contributors

May be freely distributed under the [MIT license](https://raw.githubusercontent.com/lorenwest/node-config/master/LICENSE).
May be freely distributed under the [MIT license](https://raw.githubusercontent.com/node-config/node-config/master/LICENSE).
Copyright (c) 2010-2020 Loren West
[and other contributors](https://github.com/lorenwest/node-config/graphs/contributors)
Copyright (c) 2010-2022 Loren West
[and other contributors](https://github.com/node-config/node-config/graphs/contributors)

Sorry, the diff of this file is not supported yet

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