An optimized version of the classify client endpoint in Normandy
Перейти к файлу
Mike Cooper 3b191105d8
Merge pull request #30 from mozilla/support-normandy-path
Support path used by normandy
2018-12-21 14:56:49 -08:00
.circleci Post-merge fixes 2018-12-21 20:14:27 +01:00
src Make cargo fmt happy 2018-12-21 17:00:47 -05: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
Cargo.lock Merge remote-tracking branch 'upstream/master' into better-ips 2018-12-21 12:24:55 -08:00
Cargo.toml Merge remote-tracking branch 'upstream/master' into better-ips 2018-12-21 12:24:55 -08:00
Dockerfile Fix libssl install in Docker 2018-12-21 20:15:32 +01:00
README.md Merge pull request #21 from mozilla/better-ips 2018-12-21 12:29:06 -08:00
app.yaml Updates to deploy in Google App Engine 2018-12-10 14:54:52 -08:00
build.rs Download the GeoIP DB during build 2018-12-19 16:39:30 +01:00
version.json Add dev version.json 2018-12-18 10:04:54 +01:00

README.md

Classify Client

codecov

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 be downloaded automatically during the build.

Note: It relies on curl and tar commands. See build.rs for insights about how to obtain the file manually in case the .mmdb file does not show up in the current folder.

Configuration

Via environment variables:

  • HOST: host (default: "localhost")
  • PORT: port number (default: "8080")
  • GEOIP_DB_PATH: path to GeoIP database (default: "./GeoLite2-Country.mmdb")
  • HUMAN_LOGS: set to true to use human readable logging (default: MozLog as JSON)
  • SENTRY_DSN: report errors to a Sentry instance (default: "")
  • VERSION_FILE: path to version.json file (default: "./version.json")
  • SENTRY_DSN: report errors to a Sentry instance (default: "")
  • DEBUG: A boolean that enables extra debugging options, such as a /debug endpoint that shows internal server state.
  • TRUSTED_PROXY_LIST: A comma-separated list of CIDR ranges that trusted proxies will be in. Supports both IPv4 and IPv6.

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