feat: init
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user