Compare commits
2 Commits
20faee0a37
...
d753358795
Author | SHA1 | Date | |
---|---|---|---|
d753358795 | |||
6b6c7b2356 |
@ -148,7 +148,7 @@ fn clap_cmd() -> Command {
|
|||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("port")
|
Arg::new("port")
|
||||||
.long("port")
|
.long("expose-port")
|
||||||
.value_parser(clap::value_parser!(u32).range(0..65535))
|
.value_parser(clap::value_parser!(u32).range(0..65535))
|
||||||
.action(clap::ArgAction::Append)
|
.action(clap::ArgAction::Append)
|
||||||
.help("Application exposing port")
|
.help("Application exposing port")
|
||||||
@ -394,6 +394,16 @@ fn clap_cmd() -> Command {
|
|||||||
.long("public-ip")
|
.long("public-ip")
|
||||||
.help("get a public IPv4 address for this VM")
|
.help("get a public IPv4 address for this VM")
|
||||||
.action(clap::ArgAction::SetTrue)
|
.action(clap::ArgAction::SetTrue)
|
||||||
|
.conflicts_with("port")
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("port")
|
||||||
|
.long("expose-port")
|
||||||
|
.value_parser(clap::value_parser!(u32).range(0..65535))
|
||||||
|
.action(clap::ArgAction::Append)
|
||||||
|
.help("vm exposing port")
|
||||||
|
.long_help("Port to expose on the vm which mapped into the host's public IP's port")
|
||||||
|
.conflicts_with("public-ip")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.subcommand(Command::new("inspect").about("list all available information about a VM")
|
.subcommand(Command::new("inspect").about("list all available information about a VM")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
use crate::constants::{BRAIN_STAGING, BRAIN_TESTING};
|
use crate::constants::{BRAIN_STAGING, BRAIN_TESTING, CONFIG_OVERRIDE_PATH_ENV};
|
||||||
use crate::general;
|
use crate::general;
|
||||||
use crate::utils::block_on;
|
use crate::utils::block_on;
|
||||||
use ed25519_dalek::SigningKey;
|
use ed25519_dalek::SigningKey;
|
||||||
@ -187,7 +187,9 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn cli_dir_path() -> Result<String, Error> {
|
pub fn cli_dir_path() -> Result<String, Error> {
|
||||||
let dir = Self::home_dir() + ("/.detee/cli");
|
let dir = std::env::var(CONFIG_OVERRIDE_PATH_ENV)
|
||||||
|
.unwrap_or_else(|_| Self::home_dir() + ("/.detee/cli"));
|
||||||
|
|
||||||
if !Path::new(&dir).exists() {
|
if !Path::new(&dir).exists() {
|
||||||
warn!("Could not config dir. Creating {dir}");
|
warn!("Could not config dir. Creating {dir}");
|
||||||
std::fs::create_dir_all(dir.clone())?;
|
std::fs::create_dir_all(dir.clone())?;
|
||||||
|
@ -5,6 +5,7 @@ use std::sync::LazyLock;
|
|||||||
|
|
||||||
pub const HRATLS_APP_PORT: u32 = 34500;
|
pub const HRATLS_APP_PORT: u32 = 34500;
|
||||||
pub const MAX_REDIRECTS: u16 = 3;
|
pub const MAX_REDIRECTS: u16 = 3;
|
||||||
|
pub const CONFIG_OVERRIDE_PATH_ENV: &str = "DETEE_API_USER_PATH";
|
||||||
|
|
||||||
pub const STAGING_BRAIN_URLS: [&str; 3] = [
|
pub const STAGING_BRAIN_URLS: [&str; 3] = [
|
||||||
"https://156.146.63.216:31337", // staging brain 1
|
"https://156.146.63.216:31337", // staging brain 1
|
||||||
|
@ -63,8 +63,13 @@ fn handle_vm_deploy(matches: &ArgMatches) -> Result<snp::VmSshArgs, Box<dyn Erro
|
|||||||
let location = matches.get_one::<String>("location").unwrap().as_str();
|
let location = matches.get_one::<String>("location").unwrap().as_str();
|
||||||
let ipv4: crate::snp::deploy::IPv4Config = match matches.get_one::<bool>("public-ip").unwrap() {
|
let ipv4: crate::snp::deploy::IPv4Config = match matches.get_one::<bool>("public-ip").unwrap() {
|
||||||
true => crate::snp::deploy::IPv4Config::PublicIPv4,
|
true => crate::snp::deploy::IPv4Config::PublicIPv4,
|
||||||
false => crate::snp::deploy::IPv4Config::PublishPorts(Vec::new()),
|
false => {
|
||||||
|
let exposing_port =
|
||||||
|
matches.get_many::<u32>("port").unwrap_or_default().cloned().collect::<Vec<_>>();
|
||||||
|
crate::snp::deploy::IPv4Config::PublishPorts(exposing_port)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let distro =
|
let distro =
|
||||||
crate::snp::Distro::from_string(matches.get_one::<String>("distribution").unwrap());
|
crate::snp::Distro::from_string(matches.get_one::<String>("distribution").unwrap());
|
||||||
let vm_config = snp::deploy::Request {
|
let vm_config = snp::deploy::Request {
|
||||||
|
Loading…
Reference in New Issue
Block a user