8 lines
308 B
Rust
8 lines
308 B
Rust
|
use diesel::pg::PgConnection;
|
||
|
use std::env;
|
||
|
use diesel::Connection;
|
||
|
|
||
|
pub async fn establish_connection() -> PgConnection {
|
||
|
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||
|
PgConnection::establish(&database_url).expect(&format!("Error connecting to {}", database_url))
|
||
|
}
|