actix_settings/settings/
mod.rs

1use serde::Deserialize;
2
3mod address;
4mod backlog;
5mod keep_alive;
6mod max_connection_rate;
7mod max_connections;
8mod mode;
9mod num_workers;
10mod timeout;
11#[cfg(feature = "openssl")]
12mod tls;
13
14#[cfg(feature = "openssl")]
15pub use self::tls::Tls;
16pub use self::{
17    address::Address, backlog::Backlog, keep_alive::KeepAlive,
18    max_connection_rate::MaxConnectionRate, max_connections::MaxConnections, mode::Mode,
19    num_workers::NumWorkers, timeout::Timeout,
20};
21
22/// Settings types for Actix Web.
23#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)]
24#[serde(rename_all = "kebab-case")]
25pub struct ActixSettings {
26    /// List of addresses for the server to bind to.
27    pub hosts: Vec<Address>,
28
29    /// Marker of intended deployment environment.
30    pub mode: Mode,
31
32    /// True if the `Compress` middleware should be enabled.
33    pub enable_compression: bool,
34
35    /// True if the [`Logger`](actix_web::middleware::Logger) middleware should be enabled.
36    pub enable_log: bool,
37
38    /// The number of workers that the server should start.
39    pub num_workers: NumWorkers,
40
41    /// The maximum number of pending connections.
42    pub backlog: Backlog,
43
44    /// The per-worker maximum number of concurrent connections.
45    pub max_connections: MaxConnections,
46
47    /// The per-worker maximum concurrent TLS connection limit.
48    pub max_connection_rate: MaxConnectionRate,
49
50    /// Server keep-alive preference.
51    pub keep_alive: KeepAlive,
52
53    /// Timeout duration for reading client request header.
54    pub client_timeout: Timeout,
55
56    /// Timeout duration for connection shutdown.
57    pub client_shutdown: Timeout,
58
59    /// Timeout duration for graceful worker shutdown.
60    pub shutdown_timeout: Timeout,
61
62    /// TLS (HTTPS) configuration.
63    #[cfg(feature = "openssl")]
64    pub tls: Tls,
65}