Code cleanup

This commit is contained in:
2025-06-01 18:53:42 -04:00
parent b1cabcf664
commit 35bfdb5de6
2 changed files with 0 additions and 26 deletions

View File

@@ -4,15 +4,6 @@ pub mod hashing;
pub mod repo; pub mod repo;
pub mod token_stuff; pub mod token_stuff;
/*
pub mod keys {
pub const DBURL: &str = "DATABASE_URL";
pub mod error {
pub const ERROR: &str = "DATABASE_URL must be set in .env";
}
}
*/
mod connection_settings { mod connection_settings {
pub const MAXCONN: u32 = 5; pub const MAXCONN: u32 = 5;
@@ -22,7 +13,6 @@ pub mod db {
use sqlx::postgres::PgPoolOptions; use sqlx::postgres::PgPoolOptions;
// use crate::{connection_settings, keys};
use crate::connection_settings; use crate::connection_settings;
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> { pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
@@ -35,14 +25,6 @@ pub mod db {
.await .await
} }
/*
async fn get_db_url() -> String {
#[cfg(debug_assertions)] // Example: Only load .env in debug builds
dotenvy::dotenv().ok();
env::var(keys::DBURL).expect(keys::error::ERROR)
}
*/
pub async fn migrations(pool: &sqlx::PgPool) { pub async fn migrations(pool: &sqlx::PgPool) {
// Run migrations using the sqlx::migrate! macro // Run migrations using the sqlx::migrate! macro
// Assumes your migrations are in a ./migrations folder relative to Cargo.toml // Assumes your migrations are in a ./migrations folder relative to Cargo.toml

View File

@@ -12,13 +12,6 @@ pub const MESSAGE: &str = "Something random";
pub const ISSUER: &str = "icarus_auth"; pub const ISSUER: &str = "icarus_auth";
pub const AUDIENCE: &str = "icarus"; pub const AUDIENCE: &str = "icarus";
/*
pub fn get_key() -> Result<String, dotenvy::Error> {
dotenvy::dotenv().ok();
let key = std::env::var(KEY_ENV).expect("SECRET_KEY_NOT_FOUND");
Ok(key)
}
*/
pub fn get_issued() -> time::Result<time::OffsetDateTime> { pub fn get_issued() -> time::Result<time::OffsetDateTime> {
Ok(time::OffsetDateTime::now_utc()) Ok(time::OffsetDateTime::now_utc())
@@ -53,7 +46,6 @@ pub fn create_token(provided_key: &String) -> Result<(String, i64), josekit::Jos
payload.set_expires_at(&util::time_to_std_time(&expire).unwrap()); payload.set_expires_at(&util::time_to_std_time(&expire).unwrap());
let key: String = if provided_key.is_empty() { let key: String = if provided_key.is_empty() {
// get_key().unwrap()
let rt = tokio::runtime::Runtime::new().unwrap(); let rt = tokio::runtime::Runtime::new().unwrap();
// Block on the async function to get the result // Block on the async function to get the result