From 43e0fa8b7e2e9e46e18d9dff1646b9e43103e513 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 28 Sep 2025 18:58:24 -0400 Subject: [PATCH] Added functions to get env variables --- src/environment.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/environment.rs b/src/environment.rs index d001768..37e0d27 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -33,3 +33,28 @@ pub async fn get_icarus_auth_base_api_url() -> String { std::env::var(crate::keys::ICARUS_AUTH_BASE_API_URL) .expect(crate::keys::error::ICARUS_AUTH_BASE_API_URL) } + +pub async fn get_app_env() -> String { + dotenvy::dotenv().ok(); + std::env::var(crate::keys::APP_ENV).expect(crate::keys::error::APP_ENV) +} + +pub async fn get_backend_port() -> String { + dotenvy::dotenv().ok(); + std::env::var(crate::keys::BACKEND_PORT).expect(crate::keys::error::BACKEND_PORT) +} + +pub async fn get_frontend_url() -> String { + dotenvy::dotenv().ok(); + std::env::var(crate::keys::FRONTEND_URL).expect(crate::keys::error::FRONTEND_URL) +} + +pub async fn get_rust_log() -> String { + dotenvy::dotenv().ok(); + std::env::var(crate::keys::RUST_LOG).expect(crate::keys::error::RUST_LOG) +} + +pub async fn get_allowed_origins() -> String { + dotenvy::dotenv().ok(); + std::env::var(crate::keys::ALLOWED_ORIGINS).expect(crate::keys::error::ALLOWED_ORIGINS) +}