Struct lemmy_utils::settings::structs::Settings
source · pub struct Settings {
pub database: DatabaseConfig,
pub email: Option<EmailConfig>,
pub setup: Option<SetupConfig>,
pub hostname: String,
pub bind: IpAddr,
pub port: u16,
pub tls_enabled: bool,
pub opentelemetry_url: Option<Url>,
pub worker_count: usize,
pub retry_count: usize,
pub prometheus: Option<PrometheusConfig>,
/* private fields */
}
Fields§
§database: DatabaseConfig
settings related to the postgresql database
email: Option<EmailConfig>
Email sending configuration. All options except login/password are mandatory
setup: Option<SetupConfig>
Parameters for automatic configuration of new instance (only used at first start)
hostname: String
the domain name of your instance (mandatory)
bind: IpAddr
Address where lemmy should listen for incoming requests
port: u16
Port where lemmy should listen for incoming requests
tls_enabled: bool
Whether the site is available over TLS. Needs to be true for federation to work.
opentelemetry_url: Option<Url>
Set the URL for opentelemetry exports. If you do not have an opentelemetry collector, do not set this option
worker_count: usize
The number of activitypub federation workers that can be in-flight concurrently
retry_count: usize
The number of activitypub federation retry workers that can be in-flight concurrently
prometheus: Option<PrometheusConfig>
Implementations§
source§impl Settings
impl Settings
pub fn get_database_url(&self) -> String
sourcepub fn get_protocol_string(&self) -> &'static str
pub fn get_protocol_string(&self) -> &'static str
Returns either “http” or “https”, depending on tls_enabled setting
sourcepub fn get_protocol_and_hostname(&self) -> String
pub fn get_protocol_and_hostname(&self) -> String
Returns something like http://localhost
or https://lemmy.ml
,
with the correct protocol and hostname.
sourcepub fn get_hostname_without_port(&self) -> Result<String, Error>
pub fn get_hostname_without_port(&self) -> Result<String, Error>
When running the federation test setup in api_tests/
or docker/federation
, the hostname
variable will be like lemmy-alpha:8541
. This method removes the port and returns
lemmy-alpha
instead. It has no effect in production.
pub fn webfinger_regex(&self) -> Regex
pub fn pictrs_config(&self) -> Result<PictrsConfig, LemmyError>
Trait Implementations§
source§impl Default for Settings
impl Default for Settings
source§fn default() -> Self
fn default() -> Self
Return Settings { database: Default::default(), pictrs: Some(Default::default()), email: None, setup: None, hostname: ("unset").into(), bind: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), port: 8536, tls_enabled: true, opentelemetry_url: None, worker_count: 0, retry_count: 0, prometheus: None, cors_origin: None }
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 RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnwindSafe for Settings
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self
to an expression for Diesel’s query builder. Read more