pub struct Config {
pub server: ServerCfg,
pub auth: AuthCfg,
pub ratelimit: RateLimitCfg,
pub validation: ValidationCfg,
pub headers: HeadersCfg,
pub tls: TlsCfg,
pub waf: WafCfg,
pub upstreams: Vec<UpstreamRoute>,
pub access: AccessCfg,
pub cors: CorsCfg,
pub control_plane: ControlPlaneCfg,
}Fields§
§server: ServerCfg§auth: AuthCfg§ratelimit: RateLimitCfg§validation: ValidationCfg§headers: HeadersCfg§tls: TlsCfg§waf: WafCfg§upstreams: Vec<UpstreamRoute>Optional per-path-prefix upstream overrides. Empty by default (everything goes to the
single server.upstream/app_port). A common use: /api → a backend, everything else →
a static frontend. Longest matching prefix wins; no match falls back to the default
upstream. This is a static prefix map, not a service mesh — see UpstreamRoute.
access: AccessCfgIP allow/deny lists (CIDR). Empty by default (allow all); when set, requests are gated by
client IP before auth/rate-limit. See AccessCfg.
cors: CorsCfgCross-Origin Resource Sharing policy. Off by default; when enabled, EdgeGuard answers
browser preflights and decorates responses so a separate-origin frontend can call the
app it fronts. See CorsCfg.
control_plane: ControlPlaneCfgOptional “managed mode”: pull policy from / report metrics to a remote control plane. Off by default; the edge is a standalone proxy unless this is configured.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: Option<&str>) -> Result<Config>
pub fn load(path: Option<&str>) -> Result<Config>
Load defaults, overlay an optional TOML file, then apply env overrides.
Sourcepub fn with_policy_from(&self, policy_toml: &str) -> Result<Config>
pub fn with_policy_from(&self, policy_toml: &str) -> Result<Config>
Produce an effective config by overlaying a control-plane-pushed policy document onto
this (local) config: the policy sections
(auth/ratelimit/validation/headers/waf/access/cors) come from the pushed TOML;
server/tls/upstreams/telemetry/control_plane stay local (the control plane manages
security policy, not this edge’s listener/plumbing/topology). The result feeds the normal
build_runtime + hot-swap path, so a malformed policy is rejected like any bad reload.
Sourcepub fn upstream_base(&self) -> String
pub fn upstream_base(&self) -> String
The upstream base URL EdgeGuard forwards to, e.g. “http://127.0.0.1:3000”.
Sourcepub fn upstream_probe_addr(&self) -> Option<(String, u16)>
pub fn upstream_probe_addr(&self) -> Option<(String, u16)>
The (host, port) EdgeGuard probes for readiness, mirroring Self::upstream_base:
co-process mode probes 127.0.0.1:app_port; an explicit upstream URL is parsed,
defaulting the port from the scheme. Returns None if the URL carries no usable
host, so the readiness check reports “not ready” rather than panicking.