use std::env; /// Select the compose image and optional platform, honoring /// NOMOS_TESTNET_IMAGE. pub fn resolve_image() -> (String, Option) { let image = env::var("NOMOS_TESTNET_IMAGE").unwrap_or_else(|_| String::from("nomos-testnet:local")); let platform = (image == "ghcr.io/logos-co/nomos:testnet").then(|| "linux/amd64".to_owned()); (image, platform) } /// Optional extra hosts entry for host networking. pub fn host_gateway_entry() -> Option { if let Ok(value) = env::var("COMPOSE_RUNNER_HOST_GATEWAY") { if value.eq_ignore_ascii_case("disable") || value.is_empty() { return None; } return Some(value); } if let Ok(gateway) = env::var("DOCKER_HOST_GATEWAY") { if !gateway.is_empty() { return Some(format!("host.docker.internal:{gateway}")); } } Some("host.docker.internal:host-gateway".into()) }