mb save [options]
While you can always use the API to capture the current configuration
of imposters, mountebank provides a convenient command line mechanism to save the configuration
into a file that can be used to start a subsequent process of mb
using the
--configfile
command line option. With a running mb
process operating on port
3000, you can execute the following command:
mb save --port 3000 --savefile saved.json --removeProxies
All of the parameters are optional with the defaults listed in the table below. You could then restart mountebank with the following command:
mb restart --port 3000 --configfile saved.json
The save
command takes the following options:
Option | Description | Default |
---|---|---|
--port 2525 |
The port of the running the mountebank server | 2525 |
--host mbserver.local |
The hostname of the running mountebank server | localhost |
--savefile saved.json |
The file to save imposters to | mb.json |
--formatter path/to/module |
Historically, mountebank was limited to saving all configuration in a single file when
calling mb save . A custom formatter allows you to save test data in whatever format
you want (including in ways that convert between other service virtualization products). See
below for more details. |
mountebank-formatters |
--removeProxies |
Remove proxies from the saved configuration, useful when you want to switch
from record to replay mode. Corresponds to the
removeProxies API
query parameter |
false |
--rcfile .mbrc |
The run commands file containing startup configuration (a JSON-equivalent representation
of the command line arguments). When the same option is listed
in both the rcfile and the command line, the command line option takes
precedence. |
N/A |
--help |
Show help for the command | N/A |