in apps/mountebank-mock/mountebank-source/src/models/protocols.js [192:220]
function loadCustomProtocols (protofile, logger) {
if (typeof protofile === 'undefined') {
return {};
}
const filename = path.resolve(path.relative(process.cwd(), protofile));
if (fsExtra.existsSync(filename)) {
try {
const customProtocols = require(filename);
Object.keys(customProtocols).forEach(proto => {
if (isBuiltInProtocol(proto)) {
logger.warn(`Using custom ${proto} implementation instead of the built-in one`);
}
else {
logger.info(`Loaded custom protocol ${proto}`);
}
});
return customProtocols;
}
catch (e) {
logger.error(`${protofile} contains invalid JSON -- no custom protocols loaded`);
return {};
}
}
else {
return {};
}
}