Added general environment function
All checks were successful
Rust Build / build (pull_request) Successful in 32s
Release Tagging / release (pull_request) Successful in 39s
Rust Build / Check (pull_request) Successful in 32s
Rust Build / Test Suite (pull_request) Successful in 36s
Rust Build / Rustfmt (pull_request) Successful in 33s
Rust Build / Clippy (pull_request) Successful in 41s
All checks were successful
Rust Build / build (pull_request) Successful in 32s
Release Tagging / release (pull_request) Successful in 39s
Rust Build / Check (pull_request) Successful in 32s
Rust Build / Test Suite (pull_request) Successful in 36s
Rust Build / Rustfmt (pull_request) Successful in 33s
Rust Build / Clippy (pull_request) Successful in 41s
This commit is contained in:
@@ -58,3 +58,10 @@ pub async fn get_allowed_origins() -> String {
|
|||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
std::env::var(crate::keys::ALLOWED_ORIGINS).expect(crate::keys::error::ALLOWED_ORIGINS)
|
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