feat: explicit client bypass

This commit is contained in:
cha0s 2021-01-19 10:03:48 -06:00
parent 17153dc50a
commit 1554cea35b

View File

@ -1,5 +1,5 @@
module.exports = async (latus, req) => { module.exports = async (latus, req) => {
const config = await latus.invokeReduceAsync( const plugins = await latus.invokeReduceAsync(
'@latus/http/plugins', '@latus/http/plugins',
undefined, undefined,
undefined, undefined,
@ -8,6 +8,10 @@ module.exports = async (latus, req) => {
const defaults = Object.keys(latus.originalConfig) const defaults = Object.keys(latus.originalConfig)
.map((plugin) => { .map((plugin) => {
const config = {}; const config = {};
if (false === plugins[plugin]) {
delete plugins[plugin];
return undefined;
}
[plugin, `${plugin}/client`].forEach((path) => { [plugin, `${plugin}/client`].forEach((path) => {
try { try {
// eslint-disable-next-line no-eval // eslint-disable-next-line no-eval
@ -19,9 +23,10 @@ module.exports = async (latus, req) => {
}); });
return config; return config;
}) })
.filter((config) => !!config)
.reduce((r, o) => ({...r, ...o}), {}); .reduce((r, o) => ({...r, ...o}), {});
return { return {
...defaults, ...defaults,
...config, ...plugins,
}; };
}; };