From cef9c08efa14729751a250fc117ceded8f2283df Mon Sep 17 00:00:00 2001 From: One <43485962+c-git@users.noreply.github.com> Date: Tue, 7 Jan 2025 22:10:31 -0500 Subject: [PATCH] refactor: make our shuttle service name generic --- crates/chat-app-server/src/main.rs | 8 ++++---- crates/chat-app-server/src/startup.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/chat-app-server/src/main.rs b/crates/chat-app-server/src/main.rs index 2a75beb..3c0b253 100644 --- a/crates/chat-app-server/src/main.rs +++ b/crates/chat-app-server/src/main.rs @@ -1,6 +1,6 @@ use anyhow::Context as _; use chat_app_server::startup::CustomConfiguration; -use chat_app_server::startup::ShuttleService; +use chat_app_server::startup::AppService; use wykies_server::initialize_tracing; use wykies_server::{ApiServerBuilder, ApiServerInitBundle}; @@ -13,7 +13,7 @@ async fn main( )] db_pool: sqlx::PgPool, #[shuttle_runtime::Secrets] secrets: shuttle_runtime::SecretStore, -) -> Result { +) -> Result { initialize_tracing("chat_app_server", "info", std::io::stdout); sqlx::migrate!("./migrations_pg") @@ -30,7 +30,7 @@ async fn main( .expect("failed to initialize API Server"); tracing::info!("Setup Completed"); - Ok(ShuttleService(api_server_builder)) + Ok(AppService(api_server_builder)) } #[cfg(feature = "standalone")] @@ -58,7 +58,7 @@ async fn main() -> anyhow::Result<()> { ) .context("failed to get socket address")?; - ShuttleService(api_server_builder) + AppService(api_server_builder) .bind(addr) .await .context("service runtime error") diff --git a/crates/chat-app-server/src/startup.rs b/crates/chat-app-server/src/startup.rs index 16baa37..fc0bf8a 100644 --- a/crates/chat-app-server/src/startup.rs +++ b/crates/chat-app-server/src/startup.rs @@ -98,10 +98,10 @@ pub async fn start_servers( (result, cancellation_tacker, port) } -pub struct ShuttleService(pub ApiServerBuilder); +pub struct AppService(pub ApiServerBuilder); #[async_trait] -impl shuttle_runtime::Service for ShuttleService { +impl shuttle_runtime::Service for AppService { async fn bind(self, addr: std::net::SocketAddr) -> Result<(), shuttle_runtime::Error> { let (mut join_set, cancellation_tracker, _) = start_servers(self.0, addr).await; let join_outcome = join_set.join_next().await.context("no tasks in join set")?;