pub struct Config {Show 16 fields
pub port: u16,
pub max_memory_bytes: u64,
pub max_stream_bytes: u64,
pub max_stream_name_bytes: usize,
pub max_stream_name_segments: usize,
pub cors_origins: String,
pub long_poll_timeout: Duration,
pub sse_reconnect_interval_secs: u64,
pub stream_base_path: String,
pub storage_mode: StorageMode,
pub data_dir: String,
pub acid_shard_count: usize,
pub acid_backend: AcidBackend,
pub tls_cert_path: Option<String>,
pub tls_key_path: Option<String>,
pub rust_log: String,
}Expand description
Server configuration
Fields§
§port: u16TCP port to bind the server to.
max_memory_bytes: u64Maximum total in-process payload bytes across all streams.
max_stream_bytes: u64Maximum payload bytes retained for any single stream.
max_stream_name_bytes: usizeMaximum byte length of a stream name.
max_stream_name_segments: usizeMaximum number of /-separated segments in a stream name.
cors_origins: StringCORS allowlist as "*" or a comma-separated origin list.
long_poll_timeout: DurationLong-poll timeout used by GET ?live=long-poll.
sse_reconnect_interval_secs: u64SSE reconnect interval in seconds (0 disables forced reconnects).
Matches Caddy’s sse_reconnect_interval. Connections are closed after
this many idle seconds to enable CDN request collapsing.
stream_base_path: StringMount path for the protocol HTTP surface.
storage_mode: StorageModeSelected persistence backend.
data_dir: StringRoot directory for file-backed and acid-backed storage.
Matches Caddy’s data_dir.
acid_shard_count: usizeNumber of shards used by the acid/redb backend.
acid_backend: AcidBackendRedb backend selection for the acid storage mode.
tls_cert_path: Option<String>Optional TLS certificate path in PEM format. Requires tls_key_path.
tls_key_path: Option<String>Optional TLS private key path in PEM or PKCS#8 format. Requires tls_cert_path.
rust_log: StringDefault tracing filter used when RUST_LOG is not explicitly set.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self, String>
pub fn from_env() -> Result<Self, String>
Load configuration from DS_* environment variables with sensible defaults.
Used by tests and as a simple entry point when TOML layering is not needed.
§Errors
Returns an error when any DS_* environment variable is present but invalid.
Sourcepub fn from_sources(options: &ConfigLoadOptions) -> Result<Self, String>
pub fn from_sources(options: &ConfigLoadOptions) -> Result<Self, String>
Load configuration from layered TOML files plus environment overrides.
Order (later wins):
- built-in defaults
config/default.toml(if present)config/<profile>.toml(if present)config/local.toml(if present)--config <path>override file (if provided)DS_*env vars
§Errors
Returns an error when config files cannot be parsed or an explicit override file path does not exist/read.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate configuration invariants before server startup.
§Errors
Returns an error string when config is internally inconsistent.
Sourcepub fn tls_enabled(&self) -> bool
pub fn tls_enabled(&self) -> bool
True when direct TLS termination is enabled on this server.