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: u16port
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>where
ConfigExt: Debug + DeserializeOwned,
S: IntoIterator<Item = ConfigSource<'a>>,
pub fn load_from<'a, S>(sources: S) -> Result<Self>where ConfigExt: Debug + DeserializeOwned, S: IntoIterator<Item = ConfigSource<'a>>,
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
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§
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§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>
Wrap the input message
T in a tonic::Request