pub struct Config {
pub server: ServerConfig,
pub limits: LimitsConfig,
pub http: HttpConfig,
pub storage: StorageConfig,
pub transport: TransportConfig,
pub proxy: ProxyConfig,
pub observability: ObservabilityConfig,
}Expand description
Server configuration resolved after all layering and defaults.
Fields§
§server: ServerConfigListener settings.
limits: LimitsConfigStream and storage size limits.
http: HttpConfigHTTP protocol surface configuration.
storage: StorageConfigPersistence backend configuration.
transport: TransportConfigTransport and connection behaviour.
proxy: ProxyConfigReverse-proxy trust and identity handoff.
observability: ObservabilityConfigLogging and tracing defaults.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self, ConfigLoadError>
pub fn from_env() -> Result<Self, ConfigLoadError>
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, ConfigLoadError>
pub fn from_sources( options: &ConfigLoadOptions, ) -> Result<Self, ConfigLoadError>
Load configuration from layered TOML files plus environment overrides.
Order (later wins):
- built-in defaults
- built-in profile 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<(), ConfigValidationError>
pub fn validate(&self) -> Result<(), ConfigValidationError>
Validate configuration invariants before server startup.
§Errors
Returns a typed validation error when config is internally inconsistent.
Sourcepub fn validate_profile(
&self,
profile: &DeploymentProfile,
) -> Result<(), ConfigValidationError>
pub fn validate_profile( &self, profile: &DeploymentProfile, ) -> Result<(), ConfigValidationError>
Deployment-profile-specific validation run after Config::validate.
Production profiles (prod, prod-tls, prod-mtls) reject wildcard
CORS unless the operator has explicitly set http.allow_wildcard_cors.
§Errors
Returns ConfigValidationError::WildcardCorsOriginsProd when a
production profile is active with cors_origins = "*" and the escape
hatch is not set.
Sourcepub fn warnings(&self) -> Vec<String>
pub fn warnings(&self) -> Vec<String>
Non-fatal advisories about the current configuration.
Returns human-readable warning strings that should be logged at startup
but do not block the server from starting. Currently checks for wildcard
CORS without an explicit opt-in via http.allow_wildcard_cors.
Sourcepub fn tls_enabled(&self) -> bool
pub fn tls_enabled(&self) -> bool
True when direct TLS termination is enabled on this server.
Sourcepub fn bind_socket_addr(&self) -> Result<SocketAddr, ConfigValidationError>
pub fn bind_socket_addr(&self) -> Result<SocketAddr, ConfigValidationError>
Parsed bind address used by the runtime.
§Errors
Returns the same validation error that Config::validate would emit
for an invalid bind address.
Sourcepub fn long_poll_timeout(&self) -> Duration
pub fn long_poll_timeout(&self) -> Duration
Long-poll timeout as a typed Duration.
Trait Implementations§
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.