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
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:
@@ -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()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user