From b67feb8ce5c2806dfbec5608a73c4eb7d97a4839 Mon Sep 17 00:00:00 2001 From: prplV Date: Wed, 15 Jan 2025 16:30:17 +0300 Subject: [PATCH] dotenv support + gitignore update --- .gitignore | 1 + noxis-rs/Cargo.toml | 1 + noxis-rs/src/options/preboot.rs | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 40dd2ff..f45f0c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target .idea +/.env Cargo.lock hagent_test.sock \ No newline at end of file diff --git a/noxis-rs/Cargo.toml b/noxis-rs/Cargo.toml index 62c917f..9040d12 100644 --- a/noxis-rs/Cargo.toml +++ b/noxis-rs/Cargo.toml @@ -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" diff --git a/noxis-rs/src/options/preboot.rs b/noxis-rs/src/options/preboot.rs index d5162d5..8293f8a 100644 --- a/noxis-rs/src/options/preboot.rs +++ b/noxis-rs/src/options/preboot.rs @@ -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 { + dotenv().ok(); if !self.socket_path.exists() && !self.no_hostagent { if self.socket_path.to_string_lossy() == SOCKET_PATH { self.no_hostagent = true;