mountebank-redis-repository

1.1.0 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i mountebank-redis-repository

Weekly Downloads

462

Version

1.1.0

License

ISC

Unpacked Size

150 kB

Total Files

23

Last publish

Collaborators

  • eljusto