pub struct AppConfig<ConfigExt = Empty> {
pub host: IpAddr,
pub port: u16,
pub observability_cfg: ObservabilityConfig,
pub management_cfg: ManagementConfig,
pub private: ConfigExt,
pub worker_guard: Option<WorkerGuard>,
}Expand description
AppConfig reads and saves application configuration from different sources
Fields§
§host: IpAddrhost address where to start Application
port: u16When serialized uses <PREFIX>_PORT or <PREFIX>_SERVER_PORT names.
<PREFIX>_SERVER_PORT has higher priority.
observability_cfg: ObservabilityConfigconfiguration for logs and traces
management_cfg: ManagementConfigconfigures management endpoints
private: ConfigExtfield for each application specific configuration
worker_guard: Option<WorkerGuard>Why it is here read more: [https://docs.rs/tracing-appender/latest/tracing_appender/non_blocking/struct.WorkerGuard.html]
This one will not be cloned and will be set to None in clone.
Implementations§
Source§impl<ConfigExt> AppConfig<ConfigExt>
impl<ConfigExt> AppConfig<ConfigExt>
Sourcepub fn builder() -> AppConfigBuilder<ConfigExt>
pub fn builder() -> AppConfigBuilder<ConfigExt>
Creates AppConfigBuilder to add different sources to config
Sourcepub fn default_with(file_path: &str, env_prefix: &str) -> Result<Self>where
ConfigExt: Debug + DeserializeOwned,
pub fn default_with(file_path: &str, env_prefix: &str) -> Result<Self>where
ConfigExt: Debug + DeserializeOwned,
Load file by given path and add environment variables with given prefix in addition to default config
Environment variables have highet priority then file and then default configuration
Sourcepub fn load_from<'a, S>(sources: S) -> Result<Self>
pub fn load_from<'a, S>(sources: S) -> Result<Self>
Load configuration from provided container with ConfigSource which override default config.
Trait Implementations§
Source§impl<'de, ConfigExt> Deserialize<'de> for AppConfig<ConfigExt>where
ConfigExt: Debug + DeserializeOwned,
impl<'de, ConfigExt> Deserialize<'de> for AppConfig<ConfigExt>where
ConfigExt: Debug + DeserializeOwned,
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<ConfigExt> Freeze for AppConfig<ConfigExt>where
ConfigExt: Freeze,
impl<ConfigExt = Empty> !RefUnwindSafe for AppConfig<ConfigExt>
impl<ConfigExt> Send for AppConfig<ConfigExt>where
ConfigExt: Send,
impl<ConfigExt> Sync for AppConfig<ConfigExt>where
ConfigExt: Sync,
impl<ConfigExt> Unpin for AppConfig<ConfigExt>where
ConfigExt: Unpin,
impl<ConfigExt = Empty> !UnwindSafe for AppConfig<ConfigExt>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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> 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::Request