pub struct Config {
pub port: u16,
pub max_memory_bytes: u64,
pub max_stream_bytes: u64,
pub cors_origins: String,
pub long_poll_timeout: Duration,
pub sse_reconnect_interval_secs: u64,
pub storage_mode: StorageMode,
pub data_dir: String,
pub acid_shard_count: usize,
pub tls_cert_path: Option<String>,
pub tls_key_path: Option<String>,
pub rust_log: String,
}Expand description
Server configuration
Fields§
§port: u16Port to bind the server to
max_memory_bytes: u64Maximum total memory usage in bytes
max_stream_bytes: u64Maximum bytes per stream
cors_origins: StringCORS allowed origins (comma-separated, “*” for all)
long_poll_timeout: DurationLong-poll timeout duration
sse_reconnect_interval_secs: u64SSE reconnect interval in seconds (0 disables).
Matches Caddy’s sse_reconnect_interval. Connections are closed after
this many idle seconds to enable CDN request collapsing.
storage_mode: StorageModeSelected storage mode
data_dir: StringRoot directory for file/acid-backed storage.
Matches Caddy’s data_dir.
acid_shard_count: usizeNumber of shards for acid/redb storage mode.
tls_cert_path: Option<String>Optional TLS certificate path (PEM). Requires tls_key_path.
tls_key_path: Option<String>Optional TLS private key path (PEM or PKCS#8). Requires tls_cert_path.
rust_log: StringDefault log filter 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.