pub struct RouterConfig {
pub dashboard_dir: Option<PathBuf>,
pub rate_limit_auth: Option<u32>,
pub rate_limit_general: Option<u32>,
pub trusted_proxies: TrustedProxies,
pub enforce_https: bool,
}Expand description
Router-level configuration with sensible defaults.
Controls dashboard serving, rate limiting, and other router behaviors.
Use Default::default() for production-ready defaults, then override
individual fields as needed.
§Examples
use ironflow_api::routes::RouterConfig;
// All defaults: rate limiting enabled, no custom dashboard dir
let config = RouterConfig::default();
assert_eq!(config.rate_limit_auth, Some(10));
assert!(!config.enforce_https);
// Disable auth rate limiting, custom dashboard
let config = RouterConfig {
rate_limit_auth: None,
..RouterConfig::default()
};Fields§
§dashboard_dir: Option<PathBuf>Filesystem path to dashboard assets. When set, serves the SPA from this directory instead of the embedded build.
rate_limit_auth: Option<u32>Rate limit for auth credential routes (sign-in, sign-up, password change)
in requests per minute, applied per caller (client IP, or user for an
authenticated password change) and per targeted email.
None disables the limiter.
rate_limit_general: Option<u32>Rate limit for general public API routes in requests per minute
per IP. None disables the limiter.
trusted_proxies: TrustedProxiesReverse proxies allowed to report the client IP through the
forwarding header chosen by TrustedProxies::header. Empty by
default: the rate limiters key on the TCP peer, which requires serving
the router with into_make_service_with_connect_info::<SocketAddr>().
enforce_https: boolWhen true, requests carrying X-Forwarded-Proto: http are answered
with a 308 redirect to the HTTPS URL. Defaults to false.
Only enable behind a reverse proxy that sets X-Forwarded-Proto.