feat: add environment configuration for database and authentication, update router setup

This commit is contained in:
2025-09-06 01:55:59 +02:00
parent 3dd6c0f64b
commit 6e63dca513
12 changed files with 36 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ pub struct Config {
pub port: u32,
pub prefork: bool,
pub auth_secret: String,
pub base_url: String,
}
impl Config {
@@ -16,7 +17,8 @@ impl Config {
.parse()
.expect("PORT is not a number"),
prefork: std::env::var("PREFORK").is_ok_and(|v| v == "1"),
auth_secret: std::env::var("AUTH_SECRET").unwrap_or_else(|_| "secret".into()),
auth_secret: std::env::var("AUTH_SECRET").expect("AUTH_SECRET is not set in .env file"),
base_url: std::env::var("BASE_URL").expect("BASE_URL is not set in .env file"),
}
}