tsk-22: Add function to parse env variable to a vector of strings (#25)
All checks were successful
Release Tagging / release (push) Successful in 33s
Rust Build / Check (push) Successful in 33s
Rust Build / Test Suite (push) Successful in 31s
Rust Build / Rustfmt (push) Successful in 31s
Rust Build / Clippy (push) Successful in 32s
Rust Build / build (push) Successful in 30s

Closes #22

Reviewed-on: #25
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-10-10 19:14:15 +00:00
committed by phoenix
parent 38e0073cbe
commit 8f0d123db5
6 changed files with 67 additions and 5 deletions

View File

@@ -90,13 +90,15 @@ pub async fn get_allowed_origins() -> crate::EnvVar {
let key = crate::keys::ALLOWED_ORIGINS;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
let mut envvar = crate::init_envvar(key, &value);
crate::init_delimiter(&mut envvar, ',');
envvar
}
/// Get environment not specified in the code
pub async fn get_env(environment: &str) -> crate::EnvVar {
dotenvy::dotenv().ok();
// let key = crate::keys::
let my_error = format!("{environment} {}", crate::keys::error::GENERAL_ERROR);
let value = std::env::var(environment).expect(&my_error);