Files
Aether/crates/aether-runtime/src/config.rs
fawney19 763ff03a7b refactor: 拆分 gateway 单体为独立 crate,新增 systemd 部署方案
将 gateway 内部的 model-fetch、provider-transport、scheduler-core、
usage-runtime、video-tasks-core 模块提取为独立 crate;重构 gateway
内部模块结构(state/router/cache/data/query 等);移除大量遗留模块
文件;新增 systemd 二进制部署骨架及相关文档;更新前端 usage 相关
API 和组件。
2026-04-05 20:23:16 +08:00

49 lines
1.6 KiB
Rust

use crate::observability::{FileLoggingConfig, LogDestination, ServiceObservabilityConfig};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ServiceRuntimeConfig {
pub service_name: &'static str,
pub default_log_filter: &'static str,
pub observability: ServiceObservabilityConfig,
}
impl ServiceRuntimeConfig {
pub const fn new(service_name: &'static str, default_log_filter: &'static str) -> Self {
Self {
service_name,
default_log_filter,
observability: ServiceObservabilityConfig::new(crate::LogFormat::Pretty, service_name),
}
}
pub const fn with_log_format(mut self, log_format: crate::LogFormat) -> Self {
self.observability.log_format = log_format;
self
}
pub const fn with_log_destination(mut self, log_destination: LogDestination) -> Self {
self.observability.log_destination = log_destination;
self
}
pub fn with_file_logging(mut self, file_logging: FileLoggingConfig) -> Self {
self.observability.file_logging = Some(file_logging);
self
}
pub fn with_node_role(mut self, node_role: impl Into<String>) -> Self {
self.observability.node_role = Some(node_role.into());
self
}
pub fn with_instance_id(mut self, instance_id: impl Into<String>) -> Self {
self.observability.instance_id = Some(instance_id.into());
self
}
pub const fn with_metrics_namespace(mut self, metrics_namespace: &'static str) -> Self {
self.observability.metrics_namespace = metrics_namespace;
self
}
}