Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 1.86 KB

File metadata and controls

77 lines (53 loc) · 1.86 KB

Thunderstorm Mock Server

The server implements a mock version of the Thunderstorm API that can be used for testing purposes. All requests do nothing but log the request and the response.

Download

Download the latest release from the Releases page.

Usage

./thunderstorm-mock [options]

Options

Flag Environment Variable Default Description
-p, --port THUNDERSTORM_MOCK_PORT 8080 Port to listen on
-a, --address THUNDERSTORM_MOCK_ADDRESS (all interfaces) Address to bind to
-o, --output THUNDERSTORM_MOCK_OUTPUT (stdout) Log output file path
-v, --version Print version and exit
-h, --help Print help and exit

CLI flags take precedence over environment variables.

Examples

# Start server on default port 8080
./thunderstorm-mock

# Start server on port 9000
./thunderstorm-mock --port 9000

# Bind to localhost only and log to file
./thunderstorm-mock --address 127.0.0.1 --output server.log

# Using environment variables
THUNDERSTORM_MOCK_PORT=9000 ./thunderstorm-mock

The server will be available at http://localhost:8080 (or your configured port).


Development

Running from Source

go run main.go

Running with Docker

Build the image:

docker build --network=host -t thunderstormmock .

Run the container:

docker run --rm -it thunderstormmock

Code Generation

The server types and routing code are generated by oapi-codegen from the Thunderstorm OpenAPI specification. The spec is downloaded automatically during code generation.

To regenerate the code:

go generate ./api/...