diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/mod.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 1d697fe..a1ece8b 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,20 +1,13 @@ use diesel::pg::PgConnection; use r2d2; use r2d2_diesel::ConnectionManager; -use dotenv::dotenv; -use std::env; // An alias to the type for a pool of Diesel PostgreSql connections. type Pool = r2d2::Pool<ConnectionManager<PgConnection>>; /// Initializes a database pool. -pub fn init_db_pool() -> Pool { - dotenv().ok(); - +pub fn init_db_pool<'a>(dburl: &'a str) -> Pool { let config = r2d2::Config::default(); - let dburl = env::var("DATABASE_URL") - .expect("DATABASE_URL environment variable must be set"); - let manager = ConnectionManager::<PgConnection>::new(dburl); r2d2::Pool::new(config, manager).expect("db pool") } |