Functionality (#4)
All checks were successful
Release Tagging / release (push) Successful in 27s

Reviewed-on: #4
Co-authored-by: kdeng00 <kundeng00@pm.me>
Co-committed-by: kdeng00 <kundeng00@pm.me>
This commit is contained in:
2025-06-01 00:56:15 +00:00
committed by phoenix
parent f0726b83c9
commit 596d2afdaa
7 changed files with 680 additions and 0 deletions

View File

@@ -3,3 +3,18 @@ pub async fn get_db_url() -> String {
dotenvy::dotenv().ok();
std::env::var(crate::keys::DBURL).expect(crate::keys::error::ERROR)
}
pub async fn get_secret_main_key() -> String {
dotenvy::dotenv().ok();
std::env::var(crate::keys::SECRET_MAIN_KEY).expect(crate::keys::error::SECRET_MAIN_KEY)
}
pub async fn get_secret_key() -> String {
dotenvy::dotenv().ok();
std::env::var(crate::keys::SECRET_KEY).expect(crate::keys::error::SECRET_KEY)
}
pub async fn get_root_directory() -> String {
dotenvy::dotenv().ok();
std::env::var(crate::keys::ROOT_DIRECTORY).expect(crate::keys::error::ROOT_DIRECTORY)
}

View File

@@ -1,5 +1,21 @@
// TODO: Change this to snake case
// Environment key for Database management
pub const DBURL: &str = "DATABASE_URL";
// Environment key for secret main key
// Used for the icarus app
pub const SECRET_MAIN_KEY: &str = "SECRET_MAIN_KEY";
// Environment key for secret key
// Generic use of secret key that could be found in various apps
pub const SECRET_KEY: &str = "SECRET_KEY";
// Environment key for root directory for the icarus app
pub const ROOT_DIRECTORY: &str = "ROOT_DIRECTORY";
pub mod error {
pub const ERROR: &str = "DATABASE_URL must be set in .env";
pub const SECRET_KEY: &str = "SECRET_KEY must be set in environment file";
pub const SECRET_MAIN_KEY: &str = "SECRET_MAIN_KEY must not be set in environment file";
pub const ROOT_DIRECTORY: &str = "ROOT_DIRECTORY must not be set in environment file";
}