mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 05:02:42 +00:00
Reduce calls to config.get
This commit is contained in:
@@ -260,10 +260,11 @@ app.get('/print/:id', asyncHandler(async (req, res, next)=>{
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const localEnvironments = config.get('local_environments');
|
const localEnvironments = config.get('local_environments');
|
||||||
|
const nodeEnv = config.get('node_env');
|
||||||
// Login
|
// Login
|
||||||
app.post('/login', (req, res)=>{
|
app.post('/login', (req, res)=>{
|
||||||
// Local only
|
// Local only
|
||||||
if(!localEnvironments.includes(config.get('node_env'))){
|
if(!localEnvironments.includes(nodeEnv)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,10 +283,10 @@ app.use((req, res)=>{
|
|||||||
// Create configuration object
|
// Create configuration object
|
||||||
const configuration = {
|
const configuration = {
|
||||||
local : false,
|
local : false,
|
||||||
environment : config.get('node_env')
|
environment : nodeEnv
|
||||||
};
|
};
|
||||||
// Add local only items to configuration object
|
// Add local only items to configuration object
|
||||||
if(localEnvironments.includes(configuration.environment)){
|
if(localEnvironments.includes(nodeEnv)){
|
||||||
configuration.local = true;
|
configuration.local = true;
|
||||||
};
|
};
|
||||||
const props = {
|
const props = {
|
||||||
|
|||||||
Reference in New Issue
Block a user