use crate::AppConfig; impl AppConfig { pub fn ssh_domain(&self) -> anyhow::Result { if let Some(ssh_domain) = self.env.get("APP_SSH_DOMAIN") { return Ok(ssh_domain.to_string()); } let main_domain = self.main_domain()?; if let Some(stripped) = main_domain.strip_prefix("https://") { Ok(stripped.to_string()) } else if let Some(stripped) = main_domain.strip_prefix("http://") { Ok(stripped.to_string()) } else { Ok(main_domain) } } pub fn ssh_port(&self) -> anyhow::Result { if let Some(ssh_port) = self.env.get("APP_SSH_PORT") { return Ok(ssh_port.parse::()?); } Ok(8022) } pub fn ssh_server_private_key(&self) -> anyhow::Result { if let Some(private_key) = self.env.get("APP_SSH_SERVER_PRIVATE_KEY") { return Ok(private_key.to_string()); } Ok("".to_string()) } pub fn ssh_server_public_key(&self) -> anyhow::Result { if let Some(public_key) = self.env.get("APP_SSH_SERVER_PUBLIC_KEY") { return Ok(public_key.to_string()); } Ok("".to_string()) } }