An optimized version of the classify client endpoint in Normandy
Перейти к файлу
bors[bot] ca26217b49
Merge #124
124: Fix app_data access, which I broke in the Actix Web 4 upgrade. r=smarnach a=smarnach

Accessing application state changed in Actix Web 4, and I implemented the changes in #123 only incompletely. With this change, we always use the `Data` wrapper for the endpoint state, which fixes the problem.

Co-authored-by: Sven Marnach <sven@mozilla.com>
2022-05-06 15:29:33 +00:00
.cargo Ignore chrono vulnerabilities we are not affected by. 2022-05-05 11:48:03 +02:00
.circleci Use latest Docker images for CI and production build. 2022-04-29 10:26:47 +02:00
src Fix app_data access, which I broke in the Actix Web 4 upgrade. 2022-05-06 14:09:33 +02:00
.codecov.yml Configure codecov to be a little quieter in PRs 2019-01-09 15:22:50 -08:00
.dockerignore Updates to deploy in Google App Engine 2018-12-10 14:54:52 -08:00
.gitignore add README 2018-12-10 15:26:41 -08:00
.therapist.yml Don't use nightly-only features of rustfmt in Therapist config 2018-12-19 15:57:48 -08:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file 2019-03-30 00:05:44 -07:00
Cargo.lock Upgrade Actix Web to 4.0. 2022-04-28 15:54:23 +02:00
Cargo.toml Upgrade Actix Web to 4.0. 2022-04-28 15:54:23 +02:00
Dockerfile Use latest Docker images for CI and production build. 2022-04-29 10:26:47 +02:00
LICENSE License under MPLv2 2019-01-22 14:42:54 -08:00
README.md Remove automatic geoip database download 2021-05-13 14:32:43 -07:00
app.yaml Updates to deploy in Google App Engine 2018-12-10 14:54:52 -08:00
bors.toml Remove required reviews from bors 2019-07-18 14:04:22 -07:00
version.json Add dev version.json 2018-12-18 10:04:54 +01:00

README.md

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 will need to be provided. By default it is expected to be found at ./GeoLite2-Country.mmdb.

Configuration

Via environment variables:

  • DEBUG: Set to "true" to enable extra debugging options, such as a /debug endpoint that shows internal server state (default: "false").
  • GEOIP_DB_PATH: path to GeoIP database (default: "./GeoLite2-Country.mmdb")
  • HOST: host to bind to (default: "localhost")
  • HUMAN_LOGS: set to "true" to use human readable logging (default: MozLog as JSON)
  • METRICS_TARGET: The host and port to send statsd metrics to. May be a hostname like "metrics.example.com:8125" or an IP like "127.0.0.1:8125". Port is required. (default: "localhost:8125")
  • PORT: port number to bind to (default: "8000")
  • SENTRY_DSN: report errors to a Sentry instance (default: "")
  • TRUSTED_PROXY_LIST: A comma-separated list of CIDR ranges that trusted proxies will be in. Supports both IPv4 and IPv6.
  • VERSION_FILE: path to version.json file (default: "./version.json")

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