pub struct Config {
pub server: Server,
pub auth: Auth,
pub limits: Limits,
pub security: Security,
pub log: Log,
}Expand description
The complete server configuration.
Fields§
§server: ServerListener, certificate and ALPN settings.
auth: AuthCredentials accepted on CONNECT requests.
limits: LimitsResource limits.
security: SecurityDestination policy and abuse mitigations.
log: LogLogging settings.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: &Path) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Reads and validates the configuration at path.
A parse failure is rendered by parse_error rather than carried in the
error chain, because this file holds passwords and the toml crate’s own
Display prints the offending source line.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks everything that TOML deserialization cannot express.
Every error names the offending field so the operator does not have to guess which key is wrong. Checks are ordered cheapest first, so a syntactic mistake is reported without touching the filesystem.
Source§impl Config
impl Config
Sourcepub fn warnings(&self) -> Vec<String>
pub fn warnings(&self) -> Vec<String>
Settings that are legal but that an operator should be told about.
Returned rather than logged so the caller can emit them after the
tracing subscriber exists — a warning logged during load() would be
written to a subscriber that has not been installed yet, i.e. nowhere —
and so they can be asserted on in tests.
This opens and parses server.cert when security.expected_sni is not
empty, so it is a blocking file read and not only a walk over the parsed
configuration. ReloadHandle::reload calls it before it takes the
ConfigSwap guard for that reason.