Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
6 changes: 4 additions & 2 deletions lib/pxconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PxConfig {
['CSS_REF', 'cssRef'], ['CUSTOM_LOGO', 'customLogo'], ['SENSITIVE_ROUTES', 'sensitiveRoutes'], ['WHITELIST_ROUTES', 'whitelistRoutes'], ['DYNAMIC_CONFIGURATIONS', 'dynamicConfigurations'],
['MODULE_MODE', 'moduleMode'], ['FIRST_PARTY_ENABLED', 'firstPartyEnabled'], ['ADDITIONAL_ACTIVITY_HANDLER', 'additionalActivityHandler'], ['ENRICH_CUSTOM_PARAMETERS', 'enrichCustomParameters'],
['TESTING_MODE', 'testingMode'], ['WHITELIST_EXT', 'whitelistExt'], ['BYPASS_MONITOR_HEADER', 'bypassMonitorHeader'], ['ADVANCED_BLOCKING_RESPONSE', 'advancedBlockingResponse'],
['TELEMETRY_COMMAND_HEADER', 'telemetryCommandHeader']];
['TELEMETRY_COMMAND_HEADER', 'telemetryCommandHeader'], ['CUSTOM_TEMPLATE_ROOT', 'customTemplateRoot'], ['CUSTOM_TEMPLATE_DATA', 'customTemplateData']];

configKeyMapping.forEach(([targetKey, sourceKey]) => {
this.PX_DEFAULT[targetKey] = PxConfig.configurationsOverriding(this.PX_DEFAULT, params, targetKey, sourceKey);
Expand Down Expand Up @@ -208,7 +208,9 @@ function pxDefaultConfig(PX_INTERNAL) {
WHITELIST_EXT: [],
BYPASS_MONITOR_HEADER: '',
CONFIG_PATH: '',
ADVANCED_BLOCKING_RESPONSE: true
ADVANCED_BLOCKING_RESPONSE: true,
CUSTOM_TEMPLATE_ROOT: '',
CUSTOM_TEMPLATE_DATA: {}
};
}

Expand Down
5 changes: 3 additions & 2 deletions lib/pxenforcer.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,15 @@ class PxEnforcer {
hostUrl: hostUrl,
jsClientSrc: jsClientSrc,
firstPartyEnabled: this._config.FIRST_PARTY_ENABLED,
blockScript: captchaSrc
blockScript: captchaSrc,
customData: this._config.CUSTOM_TEMPLATE_DATA && JSON.stringify(this._config.CUSTOM_TEMPLATE_DATA)
};
}

compileMustache(template, props, cb) {
let htmlTemplate = '';

mu.root = `${__dirname}/templates`;
mu.root = this._config.CUSTOM_TEMPLATE_ROOT || `${__dirname}/templates`;
const compile = mu.compileAndRender(`${template}.mustache`, props);

// Building html from template into string variable
Expand Down