feat: prepare email client usage
This commit is contained in:
parent
eecab50b55
commit
13db7853bd
12 changed files with 150 additions and 208 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use learn_axum::configuration::{get_configuration, DatabaseSettings};
|
||||
use learn_axum::email_client::EmailClient;
|
||||
use learn_axum::telemetry::{get_subscriber, init_subscriber};
|
||||
use once_cell::sync::Lazy;
|
||||
use sqlx::{Connection, Executor, PgConnection, PgPool};
|
||||
|
|
@ -147,7 +148,14 @@ async fn spawn_app() -> TestApp {
|
|||
configuration.database.name = Uuid::new_v4().to_string();
|
||||
let connection_pool = configure_database(&configuration.database).await;
|
||||
|
||||
let service = learn_axum::startup::app(connection_pool.clone());
|
||||
// TODO: remove code duplication
|
||||
let sender_email = configuration
|
||||
.email_client
|
||||
.sender()
|
||||
.expect("Invalid sender email address.");
|
||||
let email_client = EmailClient::new(configuration.email_client.base_url, sender_email);
|
||||
|
||||
let service = learn_axum::startup::app(connection_pool.clone(), email_client);
|
||||
tokio::spawn(async move {
|
||||
axum::serve(listener, service).await.unwrap();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue