Skip to main content

isoloom_render/container/
hybrid.rs

1//! The containers' side of a hybrid environment, as the Compose backend writes it for the
2//! Docker host VM the Vagrant backend adds.
3
4use isoloom_plan::Environment;
5use isoloom_spec::model::Protocol;
6
7use crate::GeneratedFile;
8
9/// The containers' side of a hybrid environment.
10#[derive(Debug, Clone, PartialEq, Eq)]
11pub struct HybridContainers {
12    /// `.isoloom/hybrid/compose.yml`.
13    pub file: GeneratedFile,
14    /// The ports published on the host, in the order of the services: the Docker host forwards
15    /// them.
16    pub published: Vec<(u16, Protocol)>,
17    /// The networks containers are on, in spec order: the Docker host creates them.
18    pub networks: Vec<String>,
19}
20
21/// The Docker network a hybrid environment's container network is on the host: named after the
22/// environment.
23#[must_use]
24pub fn docker_net(env: &Environment, net: &str) -> String {
25    format!("isoloom-{}-{net}", env.name)
26}