mirror of
https://github.com/moghtech/komodo.git
synced 2026-01-25 14:08:32 -06:00
cli 0.1.12 specify whether to --add-host to core container
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1472,7 +1472,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "monitor_cli"
|
||||
version = "0.1.11"
|
||||
version = "0.1.12"
|
||||
dependencies = [
|
||||
"async_timing_util",
|
||||
"clap",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "monitor_cli"
|
||||
version = "0.1.11"
|
||||
version = "0.1.12"
|
||||
edition = "2021"
|
||||
authors = ["MoghTech"]
|
||||
description = "monitor cli | tools to setup monitor system"
|
||||
|
||||
@@ -220,6 +220,11 @@ pub fn start_core(sub_matches: &ArgMatches) {
|
||||
.parse::<RestartMode>()
|
||||
.expect("invalid restart mode");
|
||||
|
||||
let add_host = sub_matches
|
||||
.get_one::<bool>("add-internal-host")
|
||||
.map(|p| *p)
|
||||
.unwrap_or(true);
|
||||
|
||||
println!(
|
||||
"\n===================\n {} \n===================\n",
|
||||
"core config".bold()
|
||||
@@ -229,6 +234,7 @@ pub fn start_core(sub_matches: &ArgMatches) {
|
||||
println!("{}: {port}", "port".dimmed());
|
||||
println!("{}: {network}", "network".dimmed());
|
||||
println!("{}: {restart}", "restart".dimmed());
|
||||
println!("{}: {add_host}", "add internal host".dimmed());
|
||||
|
||||
if !skip_enter {
|
||||
println!(
|
||||
@@ -252,7 +258,13 @@ pub fn start_core(sub_matches: &ArgMatches) {
|
||||
|
||||
let _ = run_command_pipe_to_terminal(&format!("docker stop {name} && docker container rm {name}"));
|
||||
|
||||
let command = format!("docker run -d --name {name} -p {port}:9000 --network {network} -v {config_path}:/config/config.toml --restart {restart} --add-host host.docker.internal:host-gateway {CORE_IMAGE_NAME}");
|
||||
let add_host = if add_host {
|
||||
" --add-host host.docker.internal:host-gateway"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
|
||||
let command = format!("docker run -d --name {name} -p {port}:9000 --network {network} -v {config_path}:/config/config.toml --restart {restart}{add_host} {CORE_IMAGE_NAME}");
|
||||
|
||||
let output = run_command_pipe_to_terminal(&command);
|
||||
|
||||
|
||||
@@ -110,6 +110,9 @@ fn cli() -> Command {
|
||||
.arg(
|
||||
arg!(--restart <RESTART> "sets docker restart mode of monitor core container. default is unless-stopped")
|
||||
)
|
||||
.arg(
|
||||
arg!(--add-internal-host "adds the docker flag '--add-host=host.docker.internal:host-gateway'. default is true")
|
||||
)
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
|
||||
Reference in New Issue
Block a user