From 9dd126957d74ec064ff1844e3f4403e068117e11 Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Mon, 27 Jan 2025 08:01:41 +0100 Subject: last minute changes --- root@niliara.net | Bin 0 -> 22705240 bytes src/auth.rs | 2 +- src/database/mod.rs | 8 ++------ src/main.rs | 6 ++---- 4 files changed, 5 insertions(+), 11 deletions(-) create mode 100755 root@niliara.net diff --git a/root@niliara.net b/root@niliara.net new file mode 100755 index 0000000..83a0efe Binary files /dev/null and b/root@niliara.net differ diff --git a/src/auth.rs b/src/auth.rs index 857ef6b..0635910 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -10,7 +10,7 @@ use utoipa::ToSchema; /* Set up scope */ pub fn auth_scope() -> Scope { web::scope("/auth") - .service(register) + //.service(register) .service(login) .service(delete_user) } diff --git a/src/database/mod.rs b/src/database/mod.rs index 045cf23..ab30884 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -6,8 +6,8 @@ pub mod user; use serde::{Deserialize, Serialize}; use sqlx::mysql::{MySqlPool, MySqlPoolOptions}; -use utoipa::ToSchema; use std::env; +use utoipa::ToSchema; #[derive(Serialize, Deserialize, ToSchema)] pub struct Delete { @@ -23,11 +23,7 @@ impl DatabaseWrapper { pub async fn new() -> Result { let pool: MySqlPool = MySqlPoolOptions::new() .max_connections(10) - .connect( - env::var("DATABASE_URL") - .expect("Environment variable DATABASE_URL is *probably not setted up!!") - .as_str(), - ) + .connect(env!("DATABASE_URL")) .await .unwrap(); /* This will break in case of error. It's intended. */ diff --git a/src/main.rs b/src/main.rs index fab6dd5..2f3449d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ mod api; mod auth; mod database; -mod extractors; mod doc; +mod extractors; use actix_web::web::Redirect; use actix_web::{web, App, HttpServer, Responder}; @@ -33,9 +33,7 @@ async fn main() -> std::io::Result<()> { let db = Arc::new(db_raw); /* Get jwt secret from env */ - let jwt_secret = env::var("SECRET") - .expect("environment variable SECRET is *probably not setted up!!") - .to_string(); + let jwt_secret: String = env!("SECRET").to_owned(); /* Application data struct */ let app_state = AppState { -- cgit v1.2.3