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