Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

app.js: prevent mutation of global config #1233

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions bin/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,18 @@ function App(config) {
const userAgent = req.headers['user-agent'];
const disableMenuRule = config.server.disableBurgerMenu.userAgentRule;
const { server: _droppedServerConfig, ...appConfig } = config;
let localAppConfig = appConfig;
if (disableMenuRule && userAgent && userAgent.match(disableMenuRule)) {
appConfig.burgerMenu.enabled = false;
localAppConfig = {
...appConfig,
burgerMenu: {
...appConfig.burgerMenu,
enabled: false,
},
};
}
appConfig.testGroupPer = testGroup(config, req).testGroupPer;
res.render('index', { config: appConfig });
localAppConfig.testGroupPer = testGroup(config, req).testGroupPer;
res.render('index', { config: localAppConfig });
});

if (config.server.acceptPostedLogs) {
Expand Down