classify-client/README.md

1.4 KiB

Classify Client

This is an optimized version of the classify client endpoint in Normandy.

Dev instructions

This is a normal Cargo project, so after cloning the repository, you can build and run it with

$ cargo build
$ cargo run

This project should run on the latest stable version of Rust. Unstable features are not allowed.

GeoIP Database

A GeoIP database is required. For development purposes, one can be obtained from the Maxmind website. The GeoLite2 Country database is recommended. It should be placed at the root of the repository.

Configuration

Via environment variables:

  • HOST: host (default: localhost)
  • PORT: port number (default: 8080)
  • GEOIP_DB_PATH: path to GeoIP database (default: ./GeoLite2-Country.mmdb)

Tests

Tests can be run with Cargo as well

$ cargo test

Linting

Linting is handled via Therapist. After installing it, enable the git hooks using either therapist install or therapist install --fix. The --fix variant will automatically format your code upon commit. The variant without --fix will simply show an error and ask you to reformat the code using other means before committing. Therapist runs in CI.

The checks Therapist runs are:

  • Rustfmt
  • Clippy, using the clippy::all preset