1.1.0 • Published 1 year ago

mountebank-redis-repository v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

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.