pub struct ServerConfig {
pub bind: String,
pub insecure: bool,
pub tls: Option<TlsConfig>,
pub allow_anonymous: bool,
pub watch_debounce_ms: u64,
pub max_stream_connections: usize,
pub sections: Vec<SectionConfig>,
pub clients: Vec<ClientConfig>,
pub kubernetes: Option<KubernetesAuthConfig>,
}Expand description
Everything the server needs to start.
deny_unknown_fields on purpose: a misspelled allow_anonymous that
silently stayed false would be a harmless surprise, and a misspelled
applications that silently granted nothing would be a confusing one —
but a key this struct does not know is, in a security-relevant file, a
key the operator believes is doing something. Refuse it.
Fields§
§bind: StringThe address to listen on. Loopback unless said otherwise.
insecure: boolPermits a bind address that is not loopback when this server terminates no TLS.
Without tls, a non-loopback bind means configuration —
secrets included — crossing a network in the clear unless something
in front of it is doing the encryption. Setting this is the operator
saying that something is.
With tls it is a refusal, not a no-op. The word
acknowledges an unencrypted socket, and there is not one; leaving it
set while TLS is on would make it stop meaning anything, so that
removing the TLS block later would quietly reopen the port instead of
refusing.
tls: Option<TlsConfig>TLS termination, and the client certificate that goes with it.
Absent — the default — is a server that speaks plain HTTP and expects
a terminator in front of it, exactly as before. Present is this
process terminating TLS itself, and needs the tls Cargo feature: a
build without it refuses to start rather than ignoring the block.
allow_anonymous: boolPermits a client with no token.
watch_debounce_ms: u64The file watcher’s debounce, in milliseconds. Zero disables watching, which is what an operator who reloads by other means wants.
max_stream_connections: usizeHow many change-stream connections may be open at once, across every caller and every section.
Zero turns the endpoint off, and a server with it off answers
/stream with the same 404 as everything else it does not serve — a
deployment that does not want long-lived connections says so once
here rather than in whatever is in front of it.
It is a backstop, not a rate limit. Per-caller limiting belongs to the thing in front, which is the only place that sees every replica’s share of a caller; what this bounds is the total number of sockets one process will hold open on this endpoint, so a client reconnecting in a loop cannot take the process with it.
sections: Vec<SectionConfig>The served applications and profiles.
clients: Vec<ClientConfig>The callers.
kubernetes: Option<KubernetesAuthConfig>TokenReview-backed callers: pods presenting their projected
service-account tokens. kubernetes-auth feature; in-cluster only.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn validate(&self) -> Result<(), Refusal>
pub fn validate(&self) -> Result<(), Refusal>
Every reason this configuration will not start a server.
Pure, and separate from starting, so the whole refusal surface is
testable without a socket. Server::start
calls it first and does nothing else if it says no.
§Errors
The first Refusal that applies, in the order this checks them:
the shape of the roster before the shape of the network, because an
operator fixing two problems would rather be told about the one that
is about who can read what.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more