mountebank-redis-repository
v1.1.0
Published
Imposters respository to store mountebank imposters in Redis db
Downloads
2,286
Readme
mountebank-redis-repository
Plugin for Mountebank that allows to store imposters distributedly using a Redis database.
Usage
It's recommended to create a wrapper around this plugin to pass on the configuration parameters and your own logger.
// impostersRepo.js
const repo = require('mountebank-redis-repository');
const logger = require('pino').child({ _context: 'mountebank-redis-repo' });
const repoConfig = {
redisOptions: {
socket: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
},
password: process.env.REDIS_PASSWORD,
},
};
function create(config) {
const newConfig = {
...config,
impostersRepositoryConfig: repoConfig,
};
return repo.create(newConfig, logger);
}
module.exports = {
create,
};
Then, run mb with the path to this file: mb --impostersRepository=./impostersRepo.js
.