Files
appks/config/rpc.rs
T
zhenyi 1000f8a80d chore(infra): add gRPC layer, update protobufs, remove immediate module
- Add gRPC service modules: auth, channel, channel settings, member,
  permission
- Update protobuf definitions and generated code
- Remove immediate/ real-time module (superseded by IM service)
- Update etcd discovery and registration
- Update cache, error, config, and build infrastructure
- Add ADR documentation
- Update OpenAPI spec
2026-06-10 18:49:42 +08:00

35 lines
1.0 KiB
Rust

use crate::config::AppConfig;
use crate::error::AppResult;
impl AppConfig {
pub fn rpc_self_host(&self) -> AppResult<String> {
self.get_env_or("APP_RPC_SELF_HOST", "0.0.0.0".to_string())
}
pub fn rpc_self_port(&self) -> AppResult<u16> {
self.get_env_or("APP_RPC_SELF_PORT", 50050u16)
}
pub fn rpc_self_listen_addr(&self) -> AppResult<String> {
let host = self.rpc_self_host()?;
let port = self.rpc_self_port()?;
Ok(format!("{host}:{port}"))
}
pub fn rpc_self_reflection(&self) -> AppResult<bool> {
self.get_env_or("APP_RPC_SELF_REFLECTION", false)
}
pub fn rpc_self_service_name(&self) -> AppResult<String> {
self.get_env_or("APP_RPC_SELF_SERVICE_NAME", "appks".to_string())
}
pub fn rpc_default_timeout_secs(&self) -> AppResult<u64> {
self.get_env_or("APP_RPC_DEFAULT_TIMEOUT_SECS", 10)
}
pub fn email_rpc_addr(&self) -> AppResult<Option<String>> {
self.get_env::<String>("APP_EMAIL_RPC_ADDR")
}
}