dotenv support + gitignore update
parent
0112066418
commit
b67feb8ce5
|
|
@ -1,4 +1,5 @@
|
||||||
/target
|
/target
|
||||||
.idea
|
.idea
|
||||||
|
/.env
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
hagent_test.sock
|
hagent_test.sock
|
||||||
|
|
@ -17,3 +17,4 @@ serde_json = "1.0.118"
|
||||||
sysinfo = "0.32.0"
|
sysinfo = "0.32.0"
|
||||||
tokio = { version = "1.38.0", features = ["full", "time"] }
|
tokio = { version = "1.38.0", features = ["full", "time"] }
|
||||||
noxis-cli = { path = "../noxis-cli" }
|
noxis-cli = { path = "../noxis-cli" }
|
||||||
|
dotenv = "0.15.0"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
use anyhow::{Result, Ok, Error};
|
use anyhow::{Result, Ok, Error};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::env::{var, vars};
|
use std::env::var;
|
||||||
|
use dotenv::dotenv;
|
||||||
|
|
||||||
const SOCKET_PATH: &str = "/var/run/enode/hostagent.sock";
|
const SOCKET_PATH: &str = "/var/run/enode/hostagent.sock";
|
||||||
|
|
||||||
|
|
@ -66,7 +67,6 @@ impl<'a> EnvVars {
|
||||||
},
|
},
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
std::env::set_var(self.to_string(), preboot_value);
|
std::env::set_var(self.to_string(), preboot_value);
|
||||||
println!("{:?}", vars());
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,6 +269,7 @@ pub struct PrebootParams {
|
||||||
/// ## to enable validation mechanism
|
/// ## to enable validation mechanism
|
||||||
impl PrebootParams {
|
impl PrebootParams {
|
||||||
pub fn validate(mut self) -> Result<Self> {
|
pub fn validate(mut self) -> Result<Self> {
|
||||||
|
dotenv().ok();
|
||||||
if !self.socket_path.exists() && !self.no_hostagent {
|
if !self.socket_path.exists() && !self.no_hostagent {
|
||||||
if self.socket_path.to_string_lossy() == SOCKET_PATH {
|
if self.socket_path.to_string_lossy() == SOCKET_PATH {
|
||||||
self.no_hostagent = true;
|
self.no_hostagent = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue