fix: load .env file in integration tests and examples

Add dotenvy to dev-dependencies and call dotenvy::dotenv().ok() in
the integration test common module and all examples so env vars can
be loaded from a .env file.
This commit is contained in:
Stevan Freeborn
2026-03-25 19:06:25 -05:00
parent a517aef3bd
commit 9a5e00c560
9 changed files with 20 additions and 0 deletions
+10
View File
@@ -1,7 +1,17 @@
use onspring::OnspringClient;
use std::collections::HashMap;
use std::sync::Once;
static INIT: Once = Once::new();
pub fn load_env() {
INIT.call_once(|| {
dotenvy::dotenv().ok();
});
}
pub fn required_env(name: &str) -> String {
load_env();
std::env::var(name).unwrap_or_else(|_| panic!("{} is not defined", name))
}