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

environment-configuration-resolver

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

environment-configuration-resolver - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

0

.eslintrc.json

@@ -0,0 +0,0 @@ {

38

lib/index.js

@@ -9,2 +9,3 @@ //

const objectPath = require('object-path');
const url = require('url');

@@ -22,4 +23,17 @@ // Configuration Assumptions:

const envProtocol = 'env://';
const envProtocol = 'env:';
function getUrlIfEnvironmentVariable(value) {
try {
const u = url.parse(value, true /* parse query string */);
if (u.protocol === envProtocol) {
return u;
}
}
catch (typeError) {
/* ignore */
}
return undefined;
}
function identifyPaths(node, prefix) {

@@ -37,6 +51,7 @@ prefix = prefix !== undefined ? prefix + '.' : '';

}
if (!value.startsWith(envProtocol)) {
const envUrl = getUrlIfEnvironmentVariable(value);
if (!envUrl) {
continue;
}
paths[prefix + property] = value.substr(envProtocol.length);
paths[prefix + property] = envUrl;
}

@@ -68,4 +83,17 @@ return paths;

const path = names[i];
const variableName = paths[path];
objectPath.set(object, path, provider.get(variableName));
const parsed = paths[path];
const variableName = parsed.hostname;
let variableValue = provider.get(variableName);
// Support for default variables
if (variableValue === undefined && parsed.query && parsed.query.default) {
variableValue = parsed.query.default;
}
// Loose equality "true" for boolean values
if (parsed.query && parsed.query.trueIf) {
variableValue = parsed.query.trueIf == /* loose */ variableValue;
}
objectPath.set(object, path, variableValue);
}

@@ -72,0 +100,0 @@ return callback();

@@ -0,0 +0,0 @@ MIT License

2

package.json
{
"name": "environment-configuration-resolver",
"version": "0.0.4",
"version": "0.0.5",
"description": "Helpful environment variable resolver for Node.js objects that performs a deep walk looking for a custom env:// scheme",

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

# environment-configuration-resolver-node
Helpful environment variable resolver for Node.js objects that performs a deep walk looking for a custom env:// scheme

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