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

configeur

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configeur - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

5

lib/processConfig.js

@@ -18,3 +18,2 @@ 'use strict';

const optionProperties = schema[optionName];
const envVarname = optionProperties.envVariableName;
const type = Object.prototype.hasOwnProperty.call(optionProperties, 'type') ? optionProperties.type : 'string';

@@ -27,4 +26,4 @@ const parser = parsers.get(type);

if (envNames.includes(envVarname)) {
config.set(optionName, parse(env[envVarname], parser));
if (envNames.includes(optionName)) {
config.set(optionName, parse(env[optionName], parser));
} else if (!optionProperties.required) {

@@ -31,0 +30,0 @@ config.set(optionName, parse(optionProperties.defaultValue, parser));

2

package.json
{
"name": "configeur",
"version": "1.0.2",
"version": "2.0.0",
"description": "Extensible parsing of environment variables into config.",

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

@@ -29,5 +29,4 @@ # configeur

const config = configeur({
port: {
PORT: {
defaultValue: '8000',
envVariableName: 'PORT',
type: 'number'

@@ -41,3 +40,3 @@ }

The above, assuming no values are read from the environment, will assign
config.js a `Map` instance with one key `port` with a value of `8000`.
config.js a `Map` instance with one key `PORT` with a value of `8000`.

@@ -48,3 +47,2 @@ Fields used to configure a config variable are:

| ------------------- | -------- | ----------- |
| `'envVariableName'` | `true` | The name of the environment variable to parse. Overrides the default.
| `'defaultValue'` | `false` | The value used when the variable is not found in the environment. Must always be a string, as if it has come from the environment. |

@@ -51,0 +49,0 @@ | `'required'` | `false` | Defaults to false. When true, a corresponding environment variable is required. A default will be ignored and an error thrown when the environment variable is not found.

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