pub struct ServerConfig {Show 17 fields
pub host: String,
pub port: u16,
pub max_connections: usize,
pub request_timeout_secs: u64,
pub body_limit_bytes: usize,
pub enable_cors: bool,
pub cors_allowed_origins: Vec<String>,
pub tls: Option<TlsConfig>,
pub cluster_tls: Option<ClusterTlsConfig>,
pub data_dir: Option<String>,
pub node_id: String,
pub node_name: Option<String>,
pub cluster_name: String,
pub peers: Vec<String>,
pub rate_limit_per_minute: u32,
pub login_rate_limit_per_minute: u32,
pub auth_required: bool,
}Expand description
Server configuration.
Fields§
§host: String§port: u16§max_connections: usize§request_timeout_secs: u64§body_limit_bytes: usize§enable_cors: bool§cors_allowed_origins: Vec<String>Allowed CORS origins (empty = same-origin only, “*” = any)
tls: Option<TlsConfig>§cluster_tls: Option<ClusterTlsConfig>TLS configuration for cluster (inter-node) communication
data_dir: Option<String>§node_id: StringUnique node ID
node_name: Option<String>Human-readable node name (e.g., “AxonML”, “NexusScribe”)
cluster_name: StringCluster name
peers: Vec<String>Peer addresses for cluster membership
rate_limit_per_minute: u32Rate limit: max requests per minute per IP
login_rate_limit_per_minute: u32Rate limit: max login attempts per minute per IP
auth_required: boolWhether API endpoints require authentication (default: true when admin user configured)
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn new(host: &str, port: u16) -> Self
pub fn new(host: &str, port: u16) -> Self
Create a new server config with the specified host and port.
Sourcepub fn socket_addr(&self) -> SocketAddr
pub fn socket_addr(&self) -> SocketAddr
Get the socket address for binding.
Sourcepub fn with_tls(self, cert_path: &str, key_path: &str) -> Self
pub fn with_tls(self, cert_path: &str, key_path: &str) -> Self
Enable TLS with the specified certificate and key paths.
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
Set the maximum number of concurrent connections.
Sourcepub fn with_timeout(self, secs: u64) -> Self
pub fn with_timeout(self, secs: u64) -> Self
Set the request timeout in seconds.
Sourcepub fn with_data_dir(self, data_dir: Option<String>) -> Self
pub fn with_data_dir(self, data_dir: Option<String>) -> Self
Set the data directory for persistence.
Sourcepub fn with_node_id(self, node_id: Option<String>) -> Self
pub fn with_node_id(self, node_id: Option<String>) -> Self
Set the node ID.
Sourcepub fn with_node_name(self, node_name: Option<String>) -> Self
pub fn with_node_name(self, node_name: Option<String>) -> Self
Set the node name.
Sourcepub fn with_cluster_name(self, cluster_name: String) -> Self
pub fn with_cluster_name(self, cluster_name: String) -> Self
Set the cluster name.
Sourcepub fn with_peers(self, peers: Vec<String>) -> Self
pub fn with_peers(self, peers: Vec<String>) -> Self
Set the peer addresses.
Sourcepub fn with_cluster_tls(self, cluster_tls: Option<ClusterTlsConfig>) -> Self
pub fn with_cluster_tls(self, cluster_tls: Option<ClusterTlsConfig>) -> Self
Set cluster TLS configuration.
Sourcepub fn cluster_tls_enabled(&self) -> bool
pub fn cluster_tls_enabled(&self) -> bool
Check if cluster TLS is enabled.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerConfig
impl Debug for ServerConfig
Source§impl Default for ServerConfig
impl Default for ServerConfig
Source§impl<'de> Deserialize<'de> for ServerConfig
impl<'de> Deserialize<'de> for ServerConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl UnwindSafe for ServerConfig
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more