pub struct ServerConfig {Show 24 fields
pub bind_addr: SocketAddr,
pub tls: Option<TlsConfig>,
pub auth: Option<AuthConfig>,
pub max_message_size: usize,
pub max_upload_size: usize,
pub enable_grpc_web: bool,
pub enable_reflection: bool,
pub blob_chunk_size: usize,
pub stream_channel_capacity: usize,
pub rate_limit: Option<RateLimitConfig>,
pub audit: Option<AuditConfig>,
pub shutdown: Option<ShutdownConfig>,
pub metrics: Option<MetricsConfig>,
pub max_concurrent_connections: Option<usize>,
pub max_concurrent_streams_per_connection: Option<u32>,
pub initial_window_size: Option<u32>,
pub initial_connection_window_size: Option<u32>,
pub request_timeout: Option<Duration>,
pub memory_budget: Option<MemoryBudgetConfig>,
pub rest_addr: Option<SocketAddr>,
pub web_addr: Option<SocketAddr>,
pub streaming: Option<StreamingConfig>,
pub cluster: Option<ClusterConfig>,
pub rest_config: RestConfig,
}Expand description
Server configuration.
Fields§
§bind_addr: SocketAddrAddress to bind the server to.
tls: Option<TlsConfig>TLS configuration (optional).
auth: Option<AuthConfig>Authentication configuration (optional).
max_message_size: usizeMaximum message size in bytes.
max_upload_size: usizeMaximum upload size for blob service in bytes.
enable_grpc_web: boolEnable gRPC-web support for browser clients.
enable_reflection: boolEnable reflection service for debugging.
blob_chunk_size: usizeBlob streaming chunk size.
stream_channel_capacity: usizeChannel capacity for streaming responses (backpressure control).
rate_limit: Option<RateLimitConfig>Rate limiting configuration (optional).
audit: Option<AuditConfig>Audit logging configuration (optional).
shutdown: Option<ShutdownConfig>Graceful shutdown configuration (optional).
metrics: Option<MetricsConfig>Metrics configuration (optional).
max_concurrent_connections: Option<usize>Maximum concurrent connections (None = unlimited).
max_concurrent_streams_per_connection: Option<u32>Maximum HTTP/2 streams per connection.
initial_window_size: Option<u32>HTTP/2 initial window size.
initial_connection_window_size: Option<u32>HTTP/2 connection window size.
request_timeout: Option<Duration>Request timeout.
memory_budget: Option<MemoryBudgetConfig>Memory budget configuration (optional).
rest_addr: Option<SocketAddr>REST API bind address (optional, None disables REST API).
web_addr: Option<SocketAddr>Web admin UI bind address (optional, None disables Web UI).
streaming: Option<StreamingConfig>Enhanced streaming configuration (optional).
cluster: Option<ClusterConfig>Cluster configuration for distributed mode (optional).
rest_config: RestConfigREST API configuration (CORS, body limits, etc.).
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Load configuration from environment variables.
Unset variables use defaults. Invalid values return an error.
§Supported Environment Variables
NEUMANN_BIND_ADDR- Server bind address (e.g., “0.0.0.0:9200”)NEUMANN_MAX_MESSAGE_SIZE- Maximum message size in bytesNEUMANN_MAX_UPLOAD_SIZE- Maximum upload size in bytesNEUMANN_ENABLE_GRPC_WEB- Enable gRPC-Web (true/false)NEUMANN_ENABLE_REFLECTION- Enable reflection (true/false)NEUMANN_TLS_CERT_PATH- Path to TLS certificateNEUMANN_TLS_KEY_PATH- Path to TLS private keyNEUMANN_TLS_CA_CERT_PATH- Path to CA certificate (optional)NEUMANN_RATE_LIMIT_MAX_REQUESTS- Max requests per windowNEUMANN_RATE_LIMIT_MAX_QUERIES- Max queries per windowNEUMANN_RATE_LIMIT_WINDOW_SECS- Rate limit window in secondsNEUMANN_SHUTDOWN_DRAIN_TIMEOUT_SECS- Shutdown drain timeoutNEUMANN_SHUTDOWN_GRACE_PERIOD_SECS- Shutdown grace periodNEUMANN_BLOB_CHUNK_SIZE- Blob streaming chunk sizeNEUMANN_STREAM_CHANNEL_CAPACITY- Stream channel capacityNEUMANN_MAX_CONCURRENT_CONNECTIONS- Max concurrent connectionsNEUMANN_MAX_CONCURRENT_STREAMS- Max HTTP/2 streams per connectionNEUMANN_INITIAL_WINDOW_SIZE- HTTP/2 initial window sizeNEUMANN_INITIAL_CONNECTION_WINDOW_SIZE- HTTP/2 connection windowNEUMANN_REQUEST_TIMEOUT_SECS- Request timeout in secondsNEUMANN_MEMORY_BUDGET_MAX_BYTES- Memory budget in bytesNEUMANN_MEMORY_BUDGET_LOAD_SHEDDING- Enable load shedding (true/false)
§Errors
Returns ServerError::Config if any environment variable has an invalid value.
Sourcepub const fn with_bind_addr(self, addr: SocketAddr) -> Self
pub const fn with_bind_addr(self, addr: SocketAddr) -> Self
Set the bind address.
Sourcepub fn with_auth(self, auth: AuthConfig) -> Self
pub fn with_auth(self, auth: AuthConfig) -> Self
Set authentication configuration.
Sourcepub const fn with_max_message_size(self, size: usize) -> Self
pub const fn with_max_message_size(self, size: usize) -> Self
Set maximum message size.
Sourcepub const fn with_grpc_web(self, enabled: bool) -> Self
pub const fn with_grpc_web(self, enabled: bool) -> Self
Enable or disable gRPC-web support.
Sourcepub const fn with_reflection(self, enabled: bool) -> Self
pub const fn with_reflection(self, enabled: bool) -> Self
Enable or disable reflection service.
Sourcepub const fn with_blob_chunk_size(self, size: usize) -> Self
pub const fn with_blob_chunk_size(self, size: usize) -> Self
Set blob streaming chunk size.
Sourcepub const fn with_max_upload_size(self, size: usize) -> Self
pub const fn with_max_upload_size(self, size: usize) -> Self
Set the maximum upload size for blob service.
Sourcepub const fn with_stream_channel_capacity(self, capacity: usize) -> Self
pub const fn with_stream_channel_capacity(self, capacity: usize) -> Self
Set the channel capacity for streaming responses.
Lower values provide better backpressure at the cost of throughput. Higher values allow more buffering but may use more memory.
Sourcepub const fn with_rate_limit(self, config: RateLimitConfig) -> Self
pub const fn with_rate_limit(self, config: RateLimitConfig) -> Self
Set rate limiting configuration.
Sourcepub const fn with_audit(self, config: AuditConfig) -> Self
pub const fn with_audit(self, config: AuditConfig) -> Self
Set audit logging configuration.
Sourcepub const fn with_shutdown(self, config: ShutdownConfig) -> Self
pub const fn with_shutdown(self, config: ShutdownConfig) -> Self
Set graceful shutdown configuration.
Sourcepub fn with_metrics(self, config: MetricsConfig) -> Self
pub fn with_metrics(self, config: MetricsConfig) -> Self
Set metrics configuration.
Sourcepub const fn with_max_concurrent_connections(self, max: usize) -> Self
pub const fn with_max_concurrent_connections(self, max: usize) -> Self
Set maximum concurrent connections.
Sourcepub const fn with_max_concurrent_streams_per_connection(self, max: u32) -> Self
pub const fn with_max_concurrent_streams_per_connection(self, max: u32) -> Self
Set maximum concurrent HTTP/2 streams per connection.
Sourcepub const fn with_initial_window_size(self, size: u32) -> Self
pub const fn with_initial_window_size(self, size: u32) -> Self
Set HTTP/2 initial window size.
Sourcepub const fn with_initial_connection_window_size(self, size: u32) -> Self
pub const fn with_initial_connection_window_size(self, size: u32) -> Self
Set HTTP/2 connection window size.
Sourcepub const fn with_request_timeout(self, timeout: Duration) -> Self
pub const fn with_request_timeout(self, timeout: Duration) -> Self
Set request timeout.
Sourcepub const fn with_memory_budget(self, config: MemoryBudgetConfig) -> Self
pub const fn with_memory_budget(self, config: MemoryBudgetConfig) -> Self
Set memory budget configuration.
Sourcepub const fn with_rest_addr(self, addr: SocketAddr) -> Self
pub const fn with_rest_addr(self, addr: SocketAddr) -> Self
Set REST API bind address.
Sourcepub const fn with_web_addr(self, addr: SocketAddr) -> Self
pub const fn with_web_addr(self, addr: SocketAddr) -> Self
Set Web admin UI bind address.
Sourcepub const fn with_streaming(self, config: StreamingConfig) -> Self
pub const fn with_streaming(self, config: StreamingConfig) -> Self
Set streaming configuration.
Sourcepub fn with_rest_config(self, config: RestConfig) -> Self
pub fn with_rest_config(self, config: RestConfig) -> Self
Set REST API configuration (CORS, body limits, etc.).
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
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.