diff options
author | rtkay123 <dev@kanjala.com> | 2025-07-26 18:42:32 +0200 |
---|---|---|
committer | rtkay123 <dev@kanjala.com> | 2025-07-26 18:42:32 +0200 |
commit | 236876f1d0539ac22a3977fd8599933725ad0f90 (patch) | |
tree | 5c216d71ac065621348ce05e7c6c7f7ce81c85d3 /crates/auth/src/main.rs | |
parent | cf77963db4f2b55048d725bd6250a490b0b82d64 (diff) | |
download | sellershut-236876f1d0539ac22a3977fd8599933725ad0f90.tar.bz2 sellershut-236876f1d0539ac22a3977fd8599933725ad0f90.zip |
feat(auth): create user
Diffstat (limited to 'crates/auth/src/main.rs')
-rw-r--r-- | crates/auth/src/main.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/crates/auth/src/main.rs b/crates/auth/src/main.rs index 53a18dd..3f68e2f 100644 --- a/crates/auth/src/main.rs +++ b/crates/auth/src/main.rs @@ -10,13 +10,17 @@ use std::net::{Ipv6Addr, SocketAddr}; use clap::Parser; use reqwest::header::CONTENT_TYPE; use sellershut_core::auth::{AUTH_FILE_DESCRIPTOR_SET, auth_server::AuthServer}; -use stack_up::{Configuration, Services, tracing::Tracing}; +use stack_up::{Configuration, tracing::Tracing}; use tokio::{signal, task::AbortHandle}; use tonic::service::Routes; use tower::{make::Shared, steer::Steer}; use tracing::{info, trace}; -use crate::{error::AppError, server::grpc::interceptor::MyInterceptor, state::AppState}; +use crate::{ + error::AppError, + server::grpc::interceptor::MyInterceptor, + state::{AppState, Services}, +}; /// auth-service #[derive(Parser, Debug)] @@ -50,16 +54,21 @@ async fn main() -> Result<(), AppError> { let _tracing = Tracing::builder().build(&config.monitoring); - let services = Services::builder() + let mut services = stack_up::Services::builder() .postgres(&config.database) .await .inspect_err(|e| tracing::error!("database: {e}"))? .build(); + let postgres = services + .postgres + .take() + .ok_or_else(|| anyhow::anyhow!("database is not ready"))?; + + let services = Services { postgres }; + trace!("running migrations"); - sqlx::migrate!("./migrations") - .run(&services.postgres) - .await?; + sqlx::migrate!("./migrations").run(&services.postgres).await?; let (state, deletion_task) = AppState::create(services, &config).await?; |