Complete Chapter 5
+ Add in More CI/CD + Update Tests and Configurations
This commit is contained in:
@@ -2,8 +2,7 @@ use mail_app::configuration::{get_configuration, DatabaseSettings};
|
||||
use mail_app::startup::run;
|
||||
use mail_app::telemetry::{get_subscriber, init_subscriber};
|
||||
use once_cell::sync::Lazy;
|
||||
use secrecy::ExposeSecret;
|
||||
use sqlx::{Executor, PgPool};
|
||||
use sqlx::{Connection, Executor, PgConnection, PgPool};
|
||||
use std::net::TcpListener;
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -47,7 +46,7 @@ async fn spawn_app() -> TestApp {
|
||||
|
||||
pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
|
||||
// Create Database
|
||||
let connection = PgPool::connect(&config.connection_string_without_db().expose_secret())
|
||||
let mut connection = PgConnection::connect_with(&config.without_db())
|
||||
.await
|
||||
.expect("Failed to connect to Postgres.");
|
||||
connection
|
||||
@@ -56,7 +55,7 @@ pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
|
||||
.expect("Failed to create database.");
|
||||
|
||||
// Migrate Database
|
||||
let connection_pool = PgPool::connect(&config.connection_string().expose_secret())
|
||||
let connection_pool = PgPool::connect_with(config.with_db())
|
||||
.await
|
||||
.expect("Failed to connect to Postgres.");
|
||||
sqlx::migrate!("./migrations")
|
||||
|
||||
Reference in New Issue
Block a user