From a8ec7cae7880488547426247542b6b7adfae353b Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 28 Sep 2025 19:20:34 -0400 Subject: [PATCH] Added general environment function --- src/environment.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/environment.rs b/src/environment.rs index 37e0d27..3c51a96 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -58,3 +58,10 @@ pub async fn get_allowed_origins() -> String { dotenvy::dotenv().ok(); std::env::var(crate::keys::ALLOWED_ORIGINS).expect(crate::keys::error::ALLOWED_ORIGINS) } + +/// Get environment not specified in the code +pub async fn get_env(environment: &str) -> String { + dotenvy::dotenv().ok(); + let my_error = format!("{environment} {}", crate::keys::error::GENERAL_ERROR); + std::env::var(environment).expect(&my_error) +}