2023-01-12 09:20:03 -05:00
|
|
|
# mirror-server
|
|
|
|
|
2024-02-23 21:29:37 -05:00
|
|
|
A simple server for mirroring HTTP requests for testing. It is optimized for
|
|
|
|
working with REST API JSON calls, and catching headers.
|
2023-01-12 09:41:47 -05:00
|
|
|
|
2024-02-21 23:17:17 -05:00
|
|
|
[![Build Status](https://ci.birch-tree.net/api/badges/dorian/mirror-server/status.svg)](https://ci.birch-tree.net/dorian/mirror-server)
|
|
|
|
|
2023-01-12 09:41:47 -05:00
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
* Use the latest stable version of Rust using rustup.
|
|
|
|
* Build: `cargo build`
|
|
|
|
* Test: `cargo test`
|
|
|
|
* Run the server: `cargo run -- --port=8080`
|
|
|
|
* Create a DEB package:
|
|
|
|
* Install cargo-deb: `cargo install cargo-deb`
|
|
|
|
* Create the DEB package: `cargo deb`
|
2024-02-07 10:12:40 -05:00
|
|
|
* Faster builds using [cargo-watch](https://watchexec.github.io/#cargo-watch): `cargo watch -x run`
|
2024-02-23 21:29:37 -05:00
|
|
|
* Installing the binary locally from source: `cargo install --path .`
|
2023-01-12 09:41:47 -05:00
|
|
|
|
2023-01-13 09:56:06 -05:00
|
|
|
## Install
|
|
|
|
|
2024-02-23 21:29:37 -05:00
|
|
|
`mirror-server` is installable either by a local Cargo install or a Debian
|
|
|
|
package. Additionally `mirror-server` can be run as a Docker container using
|
|
|
|
the latest (or tagged) release.
|
|
|
|
|
2024-02-23 14:45:18 -05:00
|
|
|
### Docker Image
|
|
|
|
|
|
|
|
Run via Docker using:
|
|
|
|
|
|
|
|
```bash
|
2024-02-23 15:41:43 -05:00
|
|
|
docker run -p 8080:8080 code.birch-tree.net/dorian/mirror-server:latest
|
2024-02-23 14:45:18 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
### Debian Package
|
|
|
|
|
2023-01-13 09:56:06 -05:00
|
|
|
Download the DEB file, and install it:
|
|
|
|
|
|
|
|
```bash
|
2024-02-07 15:01:15 -05:00
|
|
|
VERSION=0.3.0
|
2023-04-14 09:58:36 -04:00
|
|
|
REPO_URL=https://code.birch-tree.net/api/packages/dorian/generic/mirror-server/
|
|
|
|
curl "${REPO_URL}/${VERSION}/mirror-server_${VERSION}_amd64.deb"
|
|
|
|
sudo dpkg -i "mirror-server-${VERSION}_amd64.deb"
|
2023-01-13 09:56:06 -05:00
|
|
|
```
|
2023-04-14 09:58:36 -04:00
|
|
|
|
2024-02-23 14:45:18 -05:00
|
|
|
Afterward you can run using `mirror-server`
|
|
|
|
|
2024-02-23 21:29:37 -05:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```bash
|
|
|
|
> mirror-server --help
|
|
|
|
A simple server for mirror HTTP requests for testing.
|
2023-04-14 09:58:36 -04:00
|
|
|
|
2024-02-23 21:29:37 -05:00
|
|
|
Usage: mirror-server [OPTIONS]
|
|
|
|
|
|
|
|
Options:
|
|
|
|
-p, --port <PORT> Port to run on [default: 8080]
|
|
|
|
-i, --ips <IPS> Listen to IP mask [default: 0.0.0.0]
|
|
|
|
-h, --help Print help
|
|
|
|
-V, --version Print version
|
|
|
|
```
|