#[derive(Debug, Clone)]
pub struct ProductionDefaultsConfig {
pub(super) service_name: String,
pub(super) version: Option<String>,
pub(super) tracing_level: tracing::Level,
pub(super) health_endpoint_config: Option<crate::health::HealthEndpointConfig>,
pub(super) enable_request_id: bool,
pub(super) enable_tracing: bool,
pub(super) enable_health_endpoints: bool,
}
impl ProductionDefaultsConfig {
pub fn new(service_name: impl Into<String>) -> Self {
Self {
service_name: service_name.into(),
version: None,
tracing_level: tracing::Level::INFO,
health_endpoint_config: None,
enable_request_id: true,
enable_tracing: true,
enable_health_endpoints: true,
}
}
pub fn version(mut self, version: impl Into<String>) -> Self {
self.version = Some(version.into());
self
}
pub fn tracing_level(mut self, level: tracing::Level) -> Self {
self.tracing_level = level;
self
}
pub fn health_endpoint_config(mut self, config: crate::health::HealthEndpointConfig) -> Self {
self.health_endpoint_config = Some(config);
self
}
pub fn request_id(mut self, enabled: bool) -> Self {
self.enable_request_id = enabled;
self
}
pub fn tracing(mut self, enabled: bool) -> Self {
self.enable_tracing = enabled;
self
}
pub fn health_endpoints(mut self, enabled: bool) -> Self {
self.enable_health_endpoints = enabled;
self
}
}