Add multiple networks

This commit is contained in:
Maurice
2025-08-13 10:45:03 +02:00
parent 9e6b2be0ac
commit 9146046b91
3 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ pub fn generate_openrc(config: &ServiceConfig) -> String {
// start_pre()
script.push_str("start_pre() {\n");
let mut start_pre_commands = Vec::new();
if let Some(network) = &config.service.network {
for network in &config.service.networks {
start_pre_commands.push(format!("podman network create {} --ignore;", network));
}
start_pre_commands.push(format!("podman rm {} --ignore;", config.service.name));
@@ -51,7 +51,7 @@ pub fn generate_openrc(config: &ServiceConfig) -> String {
arguments.push("--detach".to_string());
}
if let Some(network) = &config.service.network {
for network in &config.service.networks {
arguments.push(format!("--network {}", network));
}
+4 -1
View File
@@ -35,7 +35,10 @@ pub struct Service {
pub name: String,
pub hostname: Option<String>,
pub image: String,
pub network: Option<String>,
#[serde(default)]
pub networks: Vec<String>,
pub restart: Option<String>,
pub detach: Option<bool>,
pub healthcheck: Option<HealthCheck>,