Move download counting to worker (#306)

* Move download counting to worker

* Run `cargo sqlx prepare`

* Format & some Clippy fixes
This commit is contained in:
Danielle authored and GitHub committed 2022-02-21 19:57:40 -07:00
1 parent 9492363b22
commit 3f671b918a
13 files changed
+126 -275

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
use actix_web::guard::GuardContext;
pub const ADMIN_KEY_HEADER: &str = "Modrinth-Admin";
pub fn admin_key_guard(ctx: &GuardContext) -> bool {
let admin_key = std::env::var("LABRINTH_ADMIN_KEY")
.expect("No admin key provided, this should have been caught by check_env_vars");
ctx.head()
.headers()
.get(ADMIN_KEY_HEADER)
.map_or(false, |it| it.as_bytes() == admin_key.as_bytes())
}
+1
View File
@@ -1,6 +1,7 @@
pub mod auth;
pub mod env;
pub mod ext;
pub mod guards;
pub mod routes;
pub mod validate;
pub mod webhook;