diff --git a/src/command_line_interface.rs b/src/command_line_interface.rs index 7dc32d17492bd941bb99f8331e47a4d62a554976..fd1be75df65058c0a84f2f355288ba5544f1aac2 100644 --- a/src/command_line_interface.rs +++ b/src/command_line_interface.rs @@ -61,17 +61,18 @@ pub struct CliOptions { pub plugins_public_domain: Option<String>, /// Docker network to use when running plugins, e.g. `docker run --network=XXX ...` - /// If not set, "host" will be used, which means that started plugins + /// If not set, "bridge" will be used, which means that started plugins /// will share the network with the host system. /// If Pod itself is running inside docker, please run both Pod and plugins /// in identical network that will then not be shared with the host system /// (this is covered in docker-compose.yml by default). #[structopt( long, + default_value = "bridge", name = "PLUGINS_DOCKER_NETWORK", - env = "POD_PLUGINS_DOCKER_NETWORK" + env = "POD_PLUGINS_DOCKER_NETWORK", )] - pub plugins_docker_network: Option<String>, + pub plugins_docker_network: String, /// File to read https public certificate from. #[structopt( @@ -186,7 +187,7 @@ pub mod tests { use_kubernetes: false, plugins_callback_address: None, plugins_public_domain: None, - plugins_docker_network: None, + plugins_docker_network: "bridge".to_string(), insecure_plugin_script: Vec::new(), tls_pub_crt: "".to_string(), tls_priv_key: "".to_string(), diff --git a/src/plugin_run.rs b/src/plugin_run.rs index 1c6a67d2ec6ef92feaabbae7a81dc7a71c81ae02..9174f7dfba8bfaf88636bf7988df4762ee987ab0 100644 --- a/src/plugin_run.rs +++ b/src/plugin_run.rs @@ -122,10 +122,6 @@ fn run_docker_container( triggered_by_item_id: &str, cli_options: &CliOptions, ) -> Result<()> { - let docker_network = match &cli_options.plugins_docker_network { - Some(net) => net.to_string(), - None => "host".to_string(), - }; let container_id = format!( "{}-{}-{}", pod_owner @@ -151,7 +147,7 @@ fn run_docker_container( }; let args: Vec<String> = vec![ "run".to_string(), - format!("--network={}", docker_network), + format!("--network={}", cli_options.plugins_docker_network), format!( "--env=POD_FULL_ADDRESS={}", callback_address(cli_options, true)