Fix maxcomplexity
This commit is contained in:
parent
f5660667c8
commit
e2e5e40ea9
@ -80,22 +80,7 @@ module.exports = function(serverOptions) {
|
|||||||
max_user_templates: global.environment.maxUserTemplates
|
max_user_templates: global.environment.maxUserTemplates
|
||||||
});
|
});
|
||||||
|
|
||||||
var surrogateKeysCacheBackends = [];
|
var surrogateKeysCache = new SurrogateKeysCache(surrogateKeysCacheBackends(serverOptions));
|
||||||
|
|
||||||
if (serverOptions.varnish_purge_enabled) {
|
|
||||||
surrogateKeysCacheBackends.push(
|
|
||||||
new VarnishHttpCacheBackend(serverOptions.varnish_host, serverOptions.varnish_http_port)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serverOptions.fastly &&
|
|
||||||
!!serverOptions.fastly.enabled && !!serverOptions.fastly.apiKey && !!serverOptions.fastly.serviceId) {
|
|
||||||
surrogateKeysCacheBackends.push(
|
|
||||||
new FastlyCacheBackend(serverOptions.fastly.apiKey, serverOptions.fastly.serviceId)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
var surrogateKeysCache = new SurrogateKeysCache(surrogateKeysCacheBackends);
|
|
||||||
|
|
||||||
function invalidateNamedMap (owner, templateName) {
|
function invalidateNamedMap (owner, templateName) {
|
||||||
var startTime = Date.now();
|
var startTime = Date.now();
|
||||||
@ -440,6 +425,7 @@ module.exports = function(serverOptions) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
// jshint maxcomplexity:6
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
};
|
};
|
||||||
@ -515,6 +501,25 @@ function setupLogger(app, opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function surrogateKeysCacheBackends(serverOptions) {
|
||||||
|
var cacheBackends = [];
|
||||||
|
|
||||||
|
if (serverOptions.varnish_purge_enabled) {
|
||||||
|
cacheBackends.push(
|
||||||
|
new VarnishHttpCacheBackend(serverOptions.varnish_host, serverOptions.varnish_http_port)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serverOptions.fastly &&
|
||||||
|
!!serverOptions.fastly.enabled && !!serverOptions.fastly.apiKey && !!serverOptions.fastly.serviceId) {
|
||||||
|
cacheBackends.push(
|
||||||
|
new FastlyCacheBackend(serverOptions.fastly.apiKey, serverOptions.fastly.serviceId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cacheBackends;
|
||||||
|
}
|
||||||
|
|
||||||
function statusFromErrorMessage(errMsg) {
|
function statusFromErrorMessage(errMsg) {
|
||||||
// Find an appropriate statusCode based on message
|
// Find an appropriate statusCode based on message
|
||||||
var statusCode = 400;
|
var statusCode = 400;
|
||||||
|
Loading…
Reference in New Issue
Block a user