2025-02-24 10:43:47 +01:00
|
|
|
use std::env;
|
|
|
|
|
use diesel::{Connection, MysqlConnection};
|
|
|
|
|
use dotenvy::dotenv;
|
|
|
|
|
use rocket::fairing::AdHoc;
|
|
|
|
|
use rocket::http::Header;
|
2025-02-23 19:33:55 +01:00
|
|
|
use rocket::routes;
|
|
|
|
|
|
|
|
|
|
mod xml;
|
|
|
|
|
mod conntest;
|
2025-02-24 10:43:47 +01:00
|
|
|
mod db;
|
|
|
|
|
mod account;
|
2025-02-23 19:33:55 +01:00
|
|
|
|
|
|
|
|
#[rocket::launch]
|
|
|
|
|
async fn launch() -> _ {
|
2025-02-24 10:43:47 +01:00
|
|
|
dotenv().ok();
|
|
|
|
|
|
|
|
|
|
let act_database_url = env::var("ACCOUNT_DATABASE_URL").expect("account database url is not set");
|
|
|
|
|
|
|
|
|
|
let conn = MysqlConnection::establish(&act_database_url).expect("unable to connect to database");
|
|
|
|
|
|
2025-02-23 19:33:55 +01:00
|
|
|
rocket::build()
|
2025-02-24 10:43:47 +01:00
|
|
|
.attach(AdHoc::on_response("org", |_, response| Box::pin(async move {
|
|
|
|
|
response.adjoin_header(Header::new("x-organization", "Nintendo"));
|
|
|
|
|
})))
|
2025-02-23 19:33:55 +01:00
|
|
|
.mount("/", routes![conntest::conntest])
|
|
|
|
|
}
|