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