Added general environment function (#20)
All checks were successful
Rust Build / Check (push) Successful in 40s
Release Tagging / release (push) Successful in 45s
Rust Build / Test Suite (push) Successful in 34s
Rust Build / Rustfmt (push) Successful in 36s
Rust Build / Clippy (push) Successful in 42s
Rust Build / build (push) Successful in 36s
All checks were successful
Rust Build / Check (push) Successful in 40s
Release Tagging / release (push) Successful in 45s
Rust Build / Test Suite (push) Successful in 34s
Rust Build / Rustfmt (push) Successful in 36s
Rust Build / Clippy (push) Successful in 42s
Rust Build / build (push) Successful in 36s
Reviewed-on: #20 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user