@contrast/config 1.46.0 → 1.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/config.js +19 -15
  2. package/package.json +2 -2
package/lib/config.js CHANGED
@@ -248,27 +248,31 @@ module.exports = class Config {
248
248
  }
249
249
 
250
250
  getReport({ redact = true }) {
251
+ const report = {
252
+ report_create: new Date(),
253
+ config: {
254
+ status: this._status
255
+ }
256
+ };
251
257
  const effective_config = [], environment_variable = [], contrast_ui = [];
252
258
 
253
259
  Array.from(this._effectiveMap.values()).forEach((v) => {
254
- let { value } = v;
255
- if (redact) value = this._redact(v.name, v.value);
260
+ let { value, name, canonical_name, source } = v;
261
+ if (value === null) return;
262
+ if (redact) value = this._redact(name, value);
263
+ value = String(value);
264
+
265
+ effective_config.push({ value, name, canonical_name, source });
256
266
 
257
- const redacted = { ...v, value: value !== null ? String(value) : null };
258
- effective_config.push(redacted);
259
- if (v.source === ENVIRONMENT_VARIABLE) environment_variable.push(redacted);
260
- if (v.source === CONTRAST_UI) contrast_ui.push(redacted);
267
+ if (source === ENVIRONMENT_VARIABLE) environment_variable.push({ value, name, canonical_name });
268
+ if (source === CONTRAST_UI) contrast_ui.push({ value, name, canonical_name });
261
269
  });
262
270
 
263
- return {
264
- report_create: new Date(),
265
- config: {
266
- status: this._status,
267
- effective_config,
268
- environment_variable,
269
- contrast_ui,
270
- }
271
- };
271
+ report.config['effective_config'] = effective_config;
272
+ if (contrast_ui.length) report.config['contrast_ui'] = contrast_ui;
273
+ if (environment_variable.length) report.config['environment_variable'] = environment_variable;
274
+
275
+ return report;
272
276
  }
273
277
 
274
278
  getEffectiveSource(canonicalName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "description": "An API for discovering Contrast agent configuration data",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@contrast/common": "1.32.0",
24
- "@contrast/core": "1.51.0",
24
+ "@contrast/core": "1.52.0",
25
25
  "yaml": "^2.2.2"
26
26
  }
27
27
  }