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

misty-config

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

misty-config - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

29

index.js

@@ -7,12 +7,27 @@ var util = require('util'),

config.util.substituteEnv = function (config) {
var decoratedEnvironment =
_.object(_(process.env).map(function (v, k) {
return [util.format("${%s}", k), v];
}));
config.util.substituteDeep(decoratedEnvironment, config);
var substituteEnv = function (config) {
function _recur(obj) {
_(obj).forEach(function (v, k) {
if (_.isString(v)) {
var match = v.match('^[$]{(.*)}$');
if (match) {
if (! process.env[match[1]]) {
throw new Error(util.format('misty-config: %s not set in the environment', v));
} else {
obj[k] = process.env[match[1]];
}
}
} else if (_.isObject(v) || _.isArray(v)) {
_recur(v);
}
});
}
_recur(config);
};
config.util.substituteEnv(config);
substituteEnv(config);
config.util.makeImmutable(config);
module.exports = config;
{
"name": "misty-config",
"version": "1.0.0",
"version": "1.0.1",
"description": "Cascading configuration with environment variable support",

@@ -5,0 +5,0 @@ "main": "index.js",

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