blob: b74f88b079f5b51f37e3d8f8ec5919a636705ad7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
// SPDX-License-Identifier: GPL-3.0-only
use std::error::Error;
use sqlx::{sqlite::SqlitePoolOptions, SqlitePool};
pub async fn get_pool() -> Result<SqlitePool, Box<dyn Error>> {
let pool = SqlitePoolOptions::new()
.max_connections(20)
.connect(&std::env::var("DATABASE_URL")?)
.await?;
debug!(
"connected to database at url '{}'",
&std::env::var("DATABASE_URL")?
);
Ok(pool)
}
|