use accounts_service::{build_app, config::Config}; #[tokio::main] async fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::init(); dotenvy::dotenv().ok(); let cfg = Config::from_env()?; cfg.validate()?; let pool = sqlx::postgres::PgPoolOptions::new() .max_connections(10) .connect(&cfg.database_url) .await?; sqlx::migrate!("./migrations").run(&pool).await?; let app = build_app(pool, &cfg); let listener = tokio::net::TcpListener::bind(("0.0.0.0", cfg.port)).await?; tracing::info!("accounts-service listening on {}", cfg.port); axum::serve(listener, app).await?; Ok(()) }