groq-model-comparison/rust-learning/src/config.rs

19 lines
361 B
Rust
Raw Normal View History

2024-12-27 07:27:22 +00:00
use dotenv::dotenv;
use std::sync::LazyLock;
pub struct Config {
pub groq_api_key: String,
}
impl Config {
pub fn new() -> Self {
dotenv().ok();
Self {
groq_api_key: std::env::var("GROQ_API_KEY").expect("GROQ_API_KEY must be set"),
}
}
}
pub static CONFIG: LazyLock<Config> = LazyLock::new(|| Config::new());