pub struct EdgeConfig {
pub listen_addr: SocketAddr,
pub brain_addr: SocketAddr,
pub pool_size: usize,
pub max_credentials: usize,
pub idle_ttl_secs: u64,
pub request_timeout_secs: u64,
pub max_body_bytes: usize,
pub wire_listen_addr: Option<SocketAddr>,
pub wire_rate_capacity: u32,
pub wire_rate_refill_per_sec: u32,
}Expand description
brain-edge configuration.
Fields§
§listen_addr: SocketAddrAddress to serve the HTTP API on.
brain_addr: SocketAddrAddress of the Brain database to proxy to.
pool_size: usizePer-credential connection-pool width to Brain.
max_credentials: usizeHard cap on distinct cached credentials (LRU-evicted over this).
idle_ttl_secs: u64Seconds of idle before a cached credential’s pool is swept.
request_timeout_secs: u64Per-request wall-clock timeout, in seconds. A request that outlives this
(e.g. a stalled Brain connection) is cut with 408 Request Timeout
rather than hanging a worker indefinitely.
max_body_bytes: usizeHard cap on request body size, in bytes. Bodies over this are rejected
with 413 Payload Too Large before the handler runs.
wire_listen_addr: Option<SocketAddr>Optional address for the transparent wire-protocol proxy listener. When
Some, the edge serves the Brain binary wire protocol here (in addition
to the HTTP data plane) — a customer SDK points at this address with its
own Brain key and the edge splices frames to Brain untouched. None
(the default) leaves the proxy off; the edge is HTTP-only.
wire_rate_capacity: u32Wire-proxy per-credential rate-limit burst ceiling. 0 (the default)
disables rate limiting on the wire path.
wire_rate_refill_per_sec: u32Wire-proxy per-credential sustained rate, in ops per second, refilled into
the burst bucket. Ignored when wire_rate_capacity is 0.
Implementations§
Source§impl EdgeConfig
impl EdgeConfig
Sourcepub fn from_env() -> Result<Self, String>
pub fn from_env() -> Result<Self, String>
Load from the environment with sane self-host defaults.
BRAIN_EDGE_LISTEN— HTTP listen addr (default0.0.0.0:8080).BRAIN_ADDR— Brain address,ip:portorhost:port(default127.0.0.1:7878).BRAIN_EDGE_POOL_SIZE— pool width per credential (default4).BRAIN_EDGE_MAX_CREDENTIALS— cap on cached credentials (default256).BRAIN_EDGE_IDLE_TTL_SECS— idle-sweep TTL in seconds (default900).BRAIN_EDGE_REQUEST_TIMEOUT_SECS— per-request timeout (default30).BRAIN_EDGE_MAX_BODY_BYTES— request body cap (default1048576= 1 MiB).BRAIN_EDGE_WIRE_LISTEN— wire-proxy listen addr,ip:portorhost:port(unset = wire proxy off).BRAIN_EDGE_WIRE_RATE_CAPACITY— per-credential burst (default0= off).BRAIN_EDGE_WIRE_RATE_REFILL_PER_SEC— per-credential ops/sec refill (default0).
§Errors
Returns a message if an address fails to parse/resolve, a numeric var is malformed, or a required-positive value is zero.