refactor: ♻️ Singleton Pattern Database Connection

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2025-01-20 03:10:42 +03:00
parent bcfcd2c6f0
commit 3f2aa572a6
37 changed files with 565 additions and 1221 deletions

View file

@ -8,14 +8,10 @@ pub mod utils;
use std::sync::LazyLock;
use feature::auth::OneTimePassword;
use sqlx::{Pool, Postgres};
use tokio::sync::RwLock;
use utils::naive_toml_parser;
pub static SERVER_CONFIG: LazyLock<ServerConfig> = LazyLock::new(ServerConfig::default);
pub static ONE_TIME_PASSWORDS: LazyLock<RwLock<Vec<OneTimePassword>>> =
LazyLock::new(OneTimePassword::init);
const DATABASE_CONFIG_FILE_LOCATION: &str = "./configs/database_config.toml";
const SERVER_CONFIG_FILE_LOCATION: &str = "./configs/server_config.toml";