teaql_tool_extra/
config.rs1use dotenvy::dotenv;
2use std::env;
3use teaql_tool_core::{Result, TeaQLToolError};
4
5pub struct ConfigTool;
6
7impl ConfigTool {
8 pub fn new() -> Self {
9 Self
10 }
11
12 pub fn load_env(&self) -> Result<()> {
13 let _ = dotenv(); Ok(())
15 }
16
17 pub fn get_env(&self, key: &str) -> Result<String> {
18 env::var(key).map_err(|_| TeaQLToolError::ExecutionError(format!("Env var {} not found", key)))
19 }
20}
21
22impl Default for ConfigTool {
23 fn default() -> Self {
24 Self::new()
25 }
26}