this_env/middleware/actix/config.rs
1//this.env/crate/src/middleware/actix/config.rs
2//by suiGn
3/// Runtime behaviour flags for the middleware.
4#[derive(Debug, Clone)]
5pub struct ActixMwConfig {
6 /// If `true`, requests whose EnvStatus is *PendingApproval* will be let through.
7 pub allow_pending: bool,
8 /// If `true`, requests whose EnvStatus is *Blocked* will be let through.
9 pub allow_blocked: bool,
10 /// If `true`, the middleware will prefer returning HTML even when the client
11 /// doesn’t explicitly ask for it (handy for browsers).
12 /// If `false`, falls back to plain‑text/JSON unless the `Accept` header contains `text/html`.
13 pub prefer_html: bool,
14 /// If `true`, the middleware won’t do any automatic decision – it will *always*
15 /// call the inner service and merely log the EnvStatus.
16 /// This lets the application layer decide what to do.
17 pub manual_mode: bool,
18 pub port: String,
19 pub instance: String,
20}
21
22impl Default for ActixMwConfig {
23 fn default() -> Self {
24 Self {
25 allow_pending: false,
26 allow_blocked: false,
27 prefer_html: false,
28 manual_mode: false,
29 port: "default".to_string(),
30 instance: "default".to_string(),
31 }
32 }
33}