aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/src/database.rs
blob: 478c97ea1ce8b79e33b8d27fb40577acd2355e1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::env;

use mysql;

use errors::*;

pub fn get_database_pool() -> Result<mysql::Pool> {
    let connection_url = env::var("DATABASE_URL")
        .chain_err(|| "DATABASE_URL environment variable not found")?;
    let pool = mysql::Pool::new_manual(4, 15, connection_url)?;

    Ok(pool)
}