0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 11:32:38 +00:00

Reduce calls to config.get

This commit is contained in:
G.Ambatte
2022-04-13 12:57:04 +12:00
parent 1bdd08f878
commit 811d1347ea

View File

@@ -260,10 +260,11 @@ app.get('/print/:id', asyncHandler(async (req, res, next)=>{
}));
const localEnvironments = config.get('local_environments');
const nodeEnv = config.get('node_env');
// Login
app.post('/login', (req, res)=>{
// Local only
if(!localEnvironments.includes(config.get('node_env'))){
if(!localEnvironments.includes(nodeEnv)){
return;
}
@@ -282,10 +283,10 @@ app.use((req, res)=>{
// Create configuration object
const configuration = {
local : false,
environment : config.get('node_env')
environment : nodeEnv
};
// Add local only items to configuration object
if(localEnvironments.includes(configuration.environment)){
if(localEnvironments.includes(nodeEnv)){
configuration.local = true;
};
const props = {