Skip to main content

Settings

Struct Settings 

Source
pub struct Settings {
Show 31 fields pub port: u16, pub hostname: Option<String>, pub resolve_hostname: bool, pub router_port: u16, pub router_hostname: Option<String>, pub auto_ping_interval: Duration, pub auto_ping_timeout: Duration, pub open_handshake_timeout: Duration, pub endpoint_scheme: String, pub endpoint_hostname: String, pub endpoint_port: u16, pub crypto_key: String, pub statsd_host: Option<String>, pub statsd_port: u16, pub statsd_label: String, pub disable_sentry: bool, pub db_dsn: Option<String>, pub db_settings: String, pub megaphone_api_url: Option<String>, pub megaphone_api_token: Option<String>, pub megaphone_poll_interval: Duration, pub human_logs: bool, pub log_chan_size: usize, pub msg_limit: u32, pub client_channel_capacity: usize, pub actix_max_connections: Option<usize>, pub actix_workers: Option<usize>, pub pool_max_idle_per_host: usize, pub pool_idle_timeout_secs: u64, pub reliability_dsn: Option<String>, pub reliability_retry_count: usize,
}
Expand description

The Applications settings, read from CLI, Environment or settings file, for the autoconnect application. These are later converted to [autoconnect::autoconnect-settings::AppState].

Fields§

§port: u16

The application port to listen on

§hostname: Option<String>

The DNS specified name of the application host to used for internal routing

§resolve_hostname: bool

The override hostname to use for internal routing (NOTE: requires hostname to be set)

§router_port: u16

The internal webpush routing port

§router_hostname: Option<String>

The DNS name to use for internal routing

§auto_ping_interval: Duration

The server based ping interval (also used for Broadcast sends)

§auto_ping_timeout: Duration

How long to wait for a response Pong before being timed out and connection drop

§open_handshake_timeout: Duration

How long to wait for the initial connection handshake.

§endpoint_scheme: String

The URL scheme (http/https) for the endpoint URL

§endpoint_hostname: String

The host url for the endpoint URL (differs from hostname and resolve_hostname)

§endpoint_port: u16

The optional port override for the endpoint URL

§crypto_key: String

The seed key to use for endpoint encryption

§statsd_host: Option<String>

The host name to send recorded metrics

§statsd_port: u16

The port number to send recorded metrics

§statsd_label: String

The root label to apply to metrics.

§disable_sentry: bool

Whether to disable Sentry error reporting

§db_dsn: Option<String>

The DSN to connect to the storage engine (Used to select between storage systems)

§db_settings: String

JSON set of specific database settings (See data storage engines)

§megaphone_api_url: Option<String>

Server endpoint to pull Broadcast ID change values (Sent in Pings)

§megaphone_api_token: Option<String>

Broadcast token for authentication (deprecated, no longer used)

§megaphone_poll_interval: Duration

How often to poll the server for new data

§human_logs: bool

Use human readable (simplified, non-JSON)

§log_chan_size: usize

Number of log records to buffer before dropping them. Records are dropped when the buffer is full, and each drop emits an ERROR level overflow report, so this should comfortably exceed the peak logging rate. 0 uses the default.

§msg_limit: u32

Maximum allowed number of backlogged messages. Exceeding this number will trigger a user reset because the user may have been offline way too long.

§client_channel_capacity: usize

Maximum number of buffered notifications per client before backpressure is applied on the notification channel.

§actix_max_connections: Option<usize>

Sets the maximum number of concurrent connections per actix-web worker.

All socket listeners will stop accepting connections when this limit is reached for each worker.

§actix_workers: Option<usize>

Sets number of actix-web workers to start (per bind address).

By default, the number of available physical CPUs is used as the worker count.

§pool_max_idle_per_host: usize

Maximum idle connections per host in the HTTP connection pool.

§pool_idle_timeout_secs: u64

Idle connection timeout in seconds.

§reliability_dsn: Option<String>

The DNS for the reliability data store. This is normally a Redis compatible storage system. See Connection Parameters for details.

§reliability_retry_count: usize

Max number of retries for retries for Redis transactions

Implementations§

Source§

impl Settings

Source

pub fn with_env_and_config_files( filenames: &[String], ) -> Result<Self, ConfigError>

Load the settings from the config files in order first then the environment.

Source

pub fn router_url(&self) -> String

Source

pub fn endpoint_url(&self) -> String

Source

pub fn validate(&self) -> Result<(), ConfigError>

Source

pub fn test_settings() -> Self

Trait Implementations§

Source§

impl Clone for Settings

Source§

fn clone(&self) -> Settings

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Settings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Settings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Settings

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,