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

fable-settings

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fable-settings - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

test/DisableEnvReplacement.json

2

package.json
{
"name": "fable-settings",
"version": "2.0.4",
"version": "2.0.5",
"description": "A simple, tolerant configuration chain.",

@@ -5,0 +5,0 @@ "main": "source/Fable-Settings.js",

@@ -24,2 +24,5 @@ /**

{
// set straight away so anything that uses it respects the initial setting
this._configureEnvTemplating(pFableSettings);
this.default = this.buildDefaultSettings();

@@ -30,5 +33,2 @@

// default environment variable templating to on
this._PerformEnvTemplating = !tmpSettings || tmpSettings.NoEnvReplacement !== true;
// The base settings object (what they were on initialization, before other actors have altered them)

@@ -78,2 +78,8 @@ this.base = JSON.parse(JSON.stringify(tmpSettings));

// Update the configuration for environment variable templating based on the current settings object
_configureEnvTemplating(pSettings)
{
// default environment variable templating to on
this._PerformEnvTemplating = !pSettings || pSettings.NoEnvReplacement !== true;
}

@@ -164,2 +170,4 @@ // Resolve (recursive) any environment variables found in settings object.

}
// update env tempating config, since we just updated the config object, and it may have changed
this._configureEnvTemplating(tmpSettingsTo);

@@ -166,0 +174,0 @@ return tmpSettingsTo;

@@ -269,2 +269,38 @@ /**

);
test
(
'updates environment variable replacement config after merging',
function()
{
process.env['NOT_DEFAULT'] = 'found_value';
const tmpFableSettings = require('../source/Fable-Settings.js').new(
{
EnvReplaced: '${NOT_DEFAULT|waffle}',
DefaultConfigFile: `${__dirname}/DisableEnvReplacement.json`,
ConfigFile: `${__dirname}/ExampleSettings.json`
});
Expect(tmpFableSettings).to.have.a.property('settings')
.that.is.a('object');
Expect(tmpFableSettings.settings).to.have.a.property('EnvReplaced')
.that.is.a('string');
Expect(tmpFableSettings.settings.EnvReplaced)
.to.equal('found_value');
Expect(tmpFableSettings.settings).to.have.a.property('Environment')
.that.is.a('string');
Expect(tmpFableSettings.settings.Environment)
.to.equal('${NOT_DEFAULT|default}-${USE_DEFAULT|default}');
Expect(tmpFableSettings.settings).to.have.a.property('EnvArray')
.that.is.an('array');
Expect(tmpFableSettings.settings.EnvArray)
.to.deep.equal(['${NOT_DEFAULT|default}', '${USE_DEFAULT|default}']);
Expect(tmpFableSettings.settings).to.have.a.property('ComplexMerge')
.that.is.an('object');
Expect(tmpFableSettings.settings.ComplexMerge).to.deep.equal(
{
OverriddenKey: 'ImportantValue',
NewKey: 'NewValue',
});
}
);
}

@@ -271,0 +307,0 @@ );

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