diff --git a/src/main.rs b/src/main.rs index 5e2264d..39073ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use axum::{ }; use serde::Deserialize; use sqlx::{query, SqlitePool}; -use std::net::SocketAddr; +use std::{env, net::SocketAddr}; use tower_http::services::ServeDir; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; @@ -28,10 +28,11 @@ async fn main() { let db_pool = SqlitePool::connect(DB_URL) .await .expect("Failed to connect to the database."); + let static_path = env::var("STATIC_PATH").unwrap_or("static".to_string()); // build our application with some routes let app = Router::new() - .nest_service("/static", ServeDir::new("static")) + .nest_service("/static", ServeDir::new(static_path)) .route("/", get(register_form)) .route("/register/", post(register)) .with_state(db_pool);