fable-settings
Advanced tools
Comparing version 2.0.4 to 2.0.5
{ | ||
"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 @@ ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
41662
15
711
0
12