Skip to content

Commit b4b39dc

Browse files
committed
Add some usage documentation to the block traffic module
1 parent b4de5e5 commit b4b39dc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ impl Default for Config {
4343
/// - `GH_CLIENT_ID`: The client ID of the associated GitHub application.
4444
/// - `GH_CLIENT_SECRET`: The client secret of the associated GitHub application.
4545
/// - `DATABASE_URL`: The URL of the postgres database to use.
46+
/// - `BLOCKED_TRAFFIC`: A list of headers and environment variables to use for blocking
47+
///. traffic. See the `block_traffic` module for more documentation.
4648
fn default() -> Config {
4749
let checkout = PathBuf::from(env("GIT_REPO_CHECKOUT"));
4850
let api_protocol = String::from("https");

src/middleware/block_traffic.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
//! Middleware that blocks requests if a header matches the given list
2+
//! To use, set the `BLOCKED_TRAFFIC` environment variable to a comma-separated list of pairs
3+
//! containing a header name, an equals sign, and the name of another environment variable that
4+
//! contains the values of that header that should be blocked. For example, set `BLOCKED_TRAFFIC`
5+
//! to `User-Agent=BLOCKED_UAS,X-Real-Ip=BLOCKED_IPS`, `BLOCKED_UAS` to `curl/7.54.0,cargo 1.36.0
6+
//! (c4fcfb725 2019-05-15)`, and `BLOCKED_IPS` to `192.168.0.1,127.0.0.1` to block requests from
7+
//! the versions of curl or Cargo specified or from either of the IPs (values are nonsensical
8+
//! examples). Values of the headers must match exactly.
29
310
use super::prelude::*;
411

0 commit comments

Comments
 (0)