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

bedrock

Package Overview
Dependencies
Maintainers
5
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bedrock - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

9

CHANGELOG.md
# bedrock ChangeLog
## 4.1.0 - 2020-12-09
### Added
- Implement `ensureConfigOverride` configuration setting. This feature provides
a mechanism for modules and top level applications to require that certain
configuration values are changed during startup. This is useful when a
deployment must use a different configuration than the development settings
to be valid.
## 4.0.0 - 2020-12-07

@@ -4,0 +13,0 @@

@@ -13,2 +13,3 @@ /*!

const events = require('./events');
const lodashGet = require('lodash.get');
const loggers = require('./loggers');

@@ -493,3 +494,21 @@ const path = require('path');

bedrockStarted = true;
// snapshot the values of the fields that must be changed
// during the `bedrock.configure` event
let configOverrideSnapshot;
if(config.ensureConfigOverride.enable) {
configOverrideSnapshot = _snapshotOverrideFields({
config,
fields: config.ensureConfigOverride.fields,
});
}
await events.emit('bedrock.configure');
// ensure that the values captured in the snapshot have been changed
if(configOverrideSnapshot) {
// throws on failure which will prevent application startup
_ensureConfigOverride({config, configOverrideSnapshot});
}
await events.emit('bedrock.admin.init');

@@ -615,1 +634,25 @@ // set process user

}
function _ensureConfigOverride({config, configOverrideSnapshot}) {
const logger = loggers.get('app').child('bedrock/worker');
logger.debug('Verifying configuration overrides.');
for(const [key, value] of configOverrideSnapshot) {
if(lodashGet(config, key) === value) {
const error = new Error(
`The config field "${key}" must be changed during the ` +
'"bedrock.configuration" event.');
logger.error(error);
throw error;
}
}
logger.debug('Configuration overrides have been verified.', {
fields: [...configOverrideSnapshot.keys()]});
}
function _snapshotOverrideFields({config, fields}) {
const snapshot = new Map();
for(const field of fields) {
snapshot.set(field, lodashGet(config, field));
}
return snapshot;
}

@@ -59,2 +59,8 @@ /*!

config.ensureConfigOverride = {};
// enable this feature when configuration overrides must occur during startup
config.ensureConfigOverride.enable = false;
// an array of path strings (e.g. 'mongodb.host', 'session-mongodb.ttl')
config.ensureConfigOverride.fields = [];
/* logging options

@@ -61,0 +67,0 @@ * formatter options:

2

package.json
{
"name": "bedrock",
"version": "4.0.0",
"version": "4.1.0",
"description": "A core foundation for rich Web applications.",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md",

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