feat(bootstrap): configurable HOST, CORS_ORIGINS, and optional rate limiting
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 5m3s
test / unit (pull_request) Successful in 16m6s
test / integration (pull_request) Failing after 17m45s

This commit is contained in:
2026-05-14 15:37:38 +02:00
parent 9b47779e63
commit 38b4774a63
4 changed files with 74 additions and 6 deletions

View File

@@ -8,6 +8,9 @@ pub struct Config {
pub allow_registration: bool,
/// true when RUST_ENV != "production" — enables AP debug mode
pub debug: bool,
pub host: String,
pub cors_origins: String,
pub rate_limit: Option<u32>,
}
impl Config {
@@ -31,6 +34,9 @@ impl Config {
debug: std::env::var("RUST_ENV")
.map(|v| v != "production")
.unwrap_or(true),
host: std::env::var("HOST").unwrap_or_else(|_| "0.0.0.0".into()),
cors_origins: std::env::var("CORS_ORIGINS").unwrap_or_else(|_| "*".into()),
rate_limit: std::env::var("RATE_LIMIT").ok().and_then(|v| v.parse().ok()),
}
}
}