pub struct Settings {Show 27 fields
pub scheme: String,
pub host: String,
pub port: u16,
pub endpoint_url: String,
pub db_dsn: Option<String>,
pub db_settings: String,
pub router_table_name: String,
pub message_table_name: String,
pub tracking_keys: String,
pub max_data_bytes: usize,
pub crypto_keys: String,
pub auth_keys: String,
pub human_logs: bool,
pub connection_timeout_millis: u64,
pub request_timeout_millis: u64,
pub pool_max_idle_per_host: usize,
pub pool_idle_timeout_secs: u64,
pub statsd_host: Option<String>,
pub statsd_port: u16,
pub statsd_label: String,
pub disable_sentry: bool,
pub fcm: FcmSettings,
pub apns: ApnsSettings,
pub stub: StubSettings,
pub reliability_dsn: Option<String>,
pub reliability_retry_count: usize,
pub max_notification_ttl: Duration,
}Fields§
§scheme: StringEndpoint URL scheme
host: StringEndpoint URL host
port: u16Endpoint URL port
endpoint_url: StringEndpoint URL. If this is set, it will override the scheme, host, and port settings.
db_dsn: Option<String>The DSN to connect to the storage engine (Used to select between storage systems)
db_settings: StringJSON set of specific database settings (See data storage engines)
router_table_name: StringThe router table name to use in the database (legacy, will be removed in the future)
message_table_name: StringThe message table name to use in the database (legacy, will be removed in the future)
tracking_keys: StringA stringified JSON list of VAPID public keys which should be tracked internally.
This should ONLY include Mozilla generated and consumed messages (e.g. “SendToTab”, etc.)
These keys should be specified in stripped, b64encoded, X962 format (e.g. a single line of
base64 encoded data without padding).
You can use scripts/convert_pem_to_x962.py to easily convert EC Public keys stored in
PEM format into appropriate x962 format.
max_data_bytes: usizeThe max size of notification data in bytes.
crypto_keys: StringThe cryptographic keys to use to encode the endpoint URL. NOTE: this must match the keys specified for autoconnect.
auth_keys: StringThe key to use to generate the client Auth token for channel management endpoints.
human_logs: boolWhether to include human readable logs in the output.
connection_timeout_millis: u64Bridge connection timeout in milliseconds.
request_timeout_millis: u64Bridge request timeout in milliseconds.
pool_max_idle_per_host: usizeMaximum idle connections per host in the HTTP connection pool.
pool_idle_timeout_secs: u64Idle connection timeout in seconds.
statsd_host: Option<String>The host for the statsd server to send metrics to. If None, metrics will not be sent.
statsd_port: u16The port for the statsd server to send metrics to.
statsd_label: StringThe label to use for statsd metrics.
disable_sentry: boolDo not report errors to sentry, instead log them to STDERR.
fcm: FcmSettingsFCM bridge settings
apns: ApnsSettingsAPNS bridge settings
stub: StubSettings“Stub” is a predictable Mock bridge that allows us to “send” data and return an expected result.
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: usizeMax number of retries reliability transactions into Redis
max_notification_ttl: DurationMax Notification Lifespan
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn with_env_and_config_file(
filename: &Option<String>,
) -> Result<Self, ConfigError>
pub fn with_env_and_config_file( filename: &Option<String>, ) -> Result<Self, ConfigError>
Load the settings from the config file if supplied, then the environment.
Sourcefn read_list_from_str<'list>(
list_str: &'list str,
panic_msg: &'static str,
) -> impl Iterator<Item = &'list str>
fn read_list_from_str<'list>( list_str: &'list str, panic_msg: &'static str, ) -> impl Iterator<Item = &'list str>
Convert a string like [item1,item2] into a iterator over item1 and item2.
Panics with a custom message if the string is not in the expected form.
Sourcepub fn make_fernet(&self) -> MultiFernet
pub fn make_fernet(&self) -> MultiFernet
Initialize the fernet encryption instance
Sourcepub fn tracking_keys(&self) -> Result<Vec<Vec<u8>>, ConfigError>
pub fn tracking_keys(&self) -> Result<Vec<Vec<u8>>, ConfigError>
Get the list of tracking public keys converted to raw, x962 format byte arrays.
(This avoids problems with formatting, padding, and other concerns. x962 precedes the
EC key pair with a \04 byte. We’ll keep that value in place for now, since the value we
are comparing against will also have the same prefix.)
Sourcepub fn endpoint_url(&self) -> Url
pub fn endpoint_url(&self) -> Url
Get the URL for this endpoint server
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Settings
impl<'de> Deserialize<'de> for Settings
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 Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnwindSafe for Settings
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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