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

Commit

Permalink
app.js: prevent mutation of global config (#1233)
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-dupre authored Nov 24, 2021
1 parent ab1ced9 commit 41ed42d
Showing 1 changed file with 10 additions and 3 deletions.
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

0 comments on commit 41ed42d

Please sign in to comment.