Migrate the rest of the code.

This commit is contained in:
Paul
2021-08-04 10:11:21 +01:00
committed by Paul Makles
parent 9fec4e48c0
commit 382972ea22
12 changed files with 49 additions and 216 deletions

View File

@@ -4,6 +4,8 @@
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate serde_json;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate impl_ops;
@@ -27,11 +29,10 @@ use rauth::{
options::{Template, Templates},
};
use rocket_cors::AllowedOrigins;
use rocket_prometheus::PrometheusMetrics;
use rocket::catchers;
use util::variables::{
APP_URL, HCAPTCHA_KEY, INVITE_ONLY, PUBLIC_URL, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD,
SMTP_USERNAME, USE_EMAIL, USE_HCAPTCHA, USE_PROMETHEUS,
SMTP_USERNAME, USE_EMAIL, USE_HCAPTCHA,
};
#[async_std::main]
@@ -122,16 +123,7 @@ Reset your password here: {{url}}",
}
let auth = Auth::new(database::get_collection("accounts"), options);
let mut rocket = rocket::ignite();
if *USE_PROMETHEUS {
info!("Enabled Prometheus metrics!");
let prometheus = PrometheusMetrics::new();
rocket = rocket
.attach(prometheus.clone())
.mount("/metrics", prometheus);
}
let rocket = rocket::build();
routes::mount(rocket)
.mount("/", rocket_cors::catch_all_options_routes())