AmbireTech / adex-supermarket

Rust implementation of the AdEx Supermarket
GNU Affero General Public License v3.0
0 stars 0 forks source link

AdEx Supermarket

Running the Supermarket

The Supermarket runs on port 3000. For a full list of all available CLI options on the Supermarket run --help:

cargo run -- --help

CLI options

supermarket [OPTIONS] -m <marketUrl>

--marketUrl / -m: required - The url of the adex-market

--config / -c: optional - If set it will use custom config file path, otherwise it will use prod.toml (production) or dev.toml (development), see the ENV environment variable for more details.

Environment variables

Docker

You can use the included Dockerfile to run the Supermarket in a container.

  1. Build the image:
docker build -t adex-supermarket .
  1. After building the image you can start a container (production):
docker run --detach -e ENV=production -p 3000:3000 -e MARKET_URL=https://market.adex.network/ adex-supermarket
docker run --detach -e ENV=production -e MARKET_URL=https://localhost:4000 adex-supermarket

When running a container you can use the same environment variables, except PORT which is set to the default 3000 and exposed by the Dockerfile. You can also set the CLI option of the Supermarket using the following environment variables:

Development & Testing

For development purposes, all you have to do is format your code with Rustfmt, fix any Clippy warnings & make sure that all the tests pass:

cargo fmt
cargo clippy
cargo test --all-features

Comparing market/supermarket output for /units-for-slot route

  1. In adex-market run npm run units-for-slot-test-output

  2. Run cargo test get_sample_units_for_slot_output -- --show-output --ignored

Supported Rust Versions 1.48.0

The supported Rust version is 1.48.0, which can be found in the rust-toolchain file.

License

This project is licensed under the AGPL-3.0 License.