Added general environment function (#20)

Reviewed-on: #20
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2025-09-29 19:22:10 +00:00
committed by phoenix
parent e51df82f09
commit 0f470ef723
6 changed files with 32 additions and 2 deletions
+7
View File
@@ -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)
}