gitdataai/lib/config/pull_request.rs
2026-05-30 01:38:40 +08:00

25 lines
667 B
Rust

use crate::AppConfig;
impl AppConfig {
pub fn pr_rpc_addr(&self) -> anyhow::Result<String> {
self.env
.get("APP_PR_RPC_ADDR")
.map(|v| v.trim().to_string())
.ok_or_else(|| anyhow::anyhow!("APP_PR_RPC_ADDR not set"))
}
pub fn pr_rpc_port(&self) -> anyhow::Result<u16> {
if let Some(port) = self.env.get("APP_PR_RPC_PORT") {
return Ok(port.parse::<u16>()?);
}
Ok(8040)
}
pub fn pr_http_port(&self) -> anyhow::Result<u16> {
if let Some(port) = self.env.get("APP_PR_HTTP_PORT") {
return Ok(port.parse::<u16>()?);
}
Ok(8041)
}
}