v0.1.10 make default --network host

This commit is contained in:
mbecker20
2023-01-25 04:01:01 +00:00
parent 9db26a3037
commit c86880ccdb
12 changed files with 208 additions and 130 deletions

View File

@@ -1,12 +1,12 @@
[package]
name = "db_client"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
types = { package = "monitor_types", version = "0.1.9" }
types = { package = "monitor_types", version = "0.1.10" }
# types = { package = "monitor_types", path = "../types" }
mungos = "0.3.0"
anyhow = "1.0"

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_helpers"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
authors = ["MoghTech"]
description = "helpers used as dependency for mogh tech monitor"
@@ -10,7 +10,7 @@ license = "GPL-3.0-or-later"
[dependencies]
# types = { package = "monitor_types", path = "../types" }
types = { package = "monitor_types", version = "0.1.9" }
types = { package = "monitor_types", version = "0.1.10" }
async_timing_util = "0.1.14"
bollard = "0.13"
anyhow = "1.0"
@@ -18,7 +18,7 @@ axum = { version = "0.6", features = ["ws", "json"] }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
toml = "0.5"
toml = "0.6"
run_command = { version = "0.0.5", features = ["async_tokio"] }
rand = "0.8"
futures = "0.3"

View File

@@ -154,12 +154,8 @@ fn parse_environment(environment: &Vec<EnvironmentVar>) -> String {
.join("")
}
fn parse_network(network: &Option<String>) -> String {
if let Some(network) = network {
format!(" --network {network}")
} else {
String::new()
}
fn parse_network(network: &str) -> String {
format!(" --network {network}")
}
fn parse_restart(restart: &RestartMode) -> String {

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_client"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
authors = ["MoghTech"]
description = "a client to interact with the monitor system"
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
monitor_types = "0.1.9"
monitor_types = "0.1.10"
# monitor_types = { path = "../types" }
reqwest = { version = "0.11", features = ["json"] }
tokio-tungstenite = { version = "0.18", features=["native-tls"] }

View File

@@ -1,13 +1,13 @@
[package]
name = "periphery_client"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
helpers = { package = "monitor_helpers", version = "0.1.9" }
types = { package = "monitor_types", version = "0.1.9" }
helpers = { package = "monitor_helpers", version = "0.1.10" }
types = { package = "monitor_types", version = "0.1.10" }
# types = { package = "monitor_types", path = "../types" }
# helpers = { package = "monitor_helpers", path = "../helpers" }
tokio-tungstenite = { version = "0.18", features=["native-tls"] }

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_types"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
authors = ["MoghTech"]
description = "types for the mogh tech monitor"

View File

@@ -109,8 +109,9 @@ pub struct DockerRunArgs {
#[diff(attr(#[serde(skip_serializing_if = "vec_diff_no_change")]))]
pub environment: Vec<EnvironmentVar>,
#[diff(attr(#[serde(skip_serializing_if = "option_diff_no_change")]))]
pub network: Option<String>,
#[serde(default = "default_network")]
#[diff(attr(#[serde(skip_serializing_if = "Option::is_none")]))]
pub network: String,
#[serde(default)]
#[diff(attr(#[serde(skip_serializing_if = "restart_mode_diff_no_change")]))]
@@ -130,6 +131,10 @@ pub struct DockerRunArgs {
pub docker_account: Option<String>, // the username of the dockerhub account
}
fn default_network() -> String {
String::from("host")
}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BasicContainerInfo {

View File

@@ -30,9 +30,9 @@ pub fn vec_diff_no_change<T: Diff>(vec_diff: &VecDiff<T>) -> bool {
pub fn docker_run_args_diff_no_change(dra: &DockerRunArgsDiff) -> bool {
dra.image.is_none()
&& dra.network.is_none()
&& option_diff_no_change(&dra.container_user)
&& option_diff_no_change(&dra.docker_account)
&& option_diff_no_change(&dra.network)
&& option_diff_no_change(&dra.post_image)
&& vec_diff_no_change(&dra.environment)
&& vec_diff_no_change(&dra.ports)