Skip to content

Commit

Permalink
Using parse is more stable and doesn't fail CI this time :P
Browse files Browse the repository at this point in the history
  • Loading branch information
Redblueflame committed Aug 30, 2021
1 parent f14e853 commit 022a2ad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/database/postgres_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ use sqlx::migrate::{Migrate, MigrateDatabase, Migrator};
use sqlx::postgres::{PgPool, PgPoolOptions};
use sqlx::{Connection, PgConnection, Postgres};
use std::path::Path;
use std::convert::TryFrom;

const MIGRATION_FOLDER: &str = "migrations";

pub async fn connect() -> Result<PgPool, sqlx::Error> {
info!("Initializing database connection");
let max_conn = dotenv::var("DB_MAX_CONN").unwrap_or("".to_string());
let max_conn = u32::try_from(max_conn).unwrap_or(5);
let max_conn = max_conn.parse().unwrap_or(5);
let database_url = dotenv::var("DATABASE_URL").expect("`DATABASE_URL` not in .env");
let pool = PgPoolOptions::new()
.max_connections(max_conn)
Expand Down

0 comments on commit 022a2ad

Please sign in to comment.