You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
369 B
13 lines
369 B
5 months ago
|
use diesel::prelude::*;
|
||
5 months ago
|
use diesel::sqlite::SqliteConnection;
|
||
|
use dotenvy::dotenv;
|
||
|
use std::env;
|
||
|
|
||
|
pub fn establish_connection() -> SqliteConnection {
|
||
|
dotenv().ok();
|
||
|
|
||
|
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||
|
SqliteConnection::establish(&database_url)
|
||
5 months ago
|
.expect(&format!("Error connecting to {}", database_url))
|
||
5 months ago
|
}
|