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_file(&self) -> anyhow::Result { if let Some(path) = self.env.get("APP_SSH_SERVER_PRIVATE_KEY_FILE") { return Ok(path.to_string()); } Ok("".to_string()) } pub fn ssh_server_public_key_file(&self) -> anyhow::Result { if let Some(path) = self.env.get("APP_SSH_SERVER_PUBLIC_KEY_FILE") { return Ok(path.to_string()); } Ok("".to_string()) } }