Migrating code to icarus_envy
Some checks failed
Rust Build / Check (pull_request) Failing after 37s
Rust Build / Test Suite (pull_request) Failing after 41s
Rust Build / Rustfmt (pull_request) Failing after 21s
Rust Build / Clippy (pull_request) Failing after 40s
Rust Build / build (pull_request) Failing after 41s
Some checks failed
Rust Build / Check (pull_request) Failing after 37s
Rust Build / Test Suite (pull_request) Failing after 41s
Rust Build / Rustfmt (pull_request) Failing after 21s
Rust Build / Clippy (pull_request) Failing after 40s
Rust Build / build (pull_request) Failing after 41s
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -4,6 +4,7 @@ pub mod hashing;
|
||||
pub mod repo;
|
||||
pub mod token_stuff;
|
||||
|
||||
/*
|
||||
pub mod keys {
|
||||
pub const DBURL: &str = "DATABASE_URL";
|
||||
|
||||
@@ -11,6 +12,7 @@ pub mod keys {
|
||||
pub const ERROR: &str = "DATABASE_URL must be set in .env";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
mod connection_settings {
|
||||
pub const MAXCONN: u32 = 5;
|
||||
@@ -21,10 +23,13 @@ pub mod db {
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use std::env;
|
||||
|
||||
use crate::{connection_settings, keys};
|
||||
use icarus_envy::keys;
|
||||
|
||||
// use crate::{connection_settings, keys};
|
||||
use crate::connection_settings;
|
||||
|
||||
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
|
||||
let database_url = get_db_url().await;
|
||||
let database_url = icarus_envy::environment::get_db_url().await;
|
||||
println!("Database url: {:?}", database_url);
|
||||
|
||||
PgPoolOptions::new()
|
||||
@@ -33,11 +38,13 @@ pub mod db {
|
||||
.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) {
|
||||
// Run migrations using the sqlx::migrate! macro
|
||||
|
Reference in New Issue
Block a user