15 lines
No EOL
589 B
Rust
15 lines
No EOL
589 B
Rust
use anyhow::Result;
|
|
use clap::Parser;
|
|
use postgres::{PostgresUserService, PostgresProductService};
|
|
use cli::Cli;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
dotenvy::from_path("config/cli-postgres.env").ok();
|
|
let pool = sqlx::PgPool::connect(&std::env::var("DATABASE_URL")?).await?;
|
|
let user_service = PostgresUserService::new(postgres::PostgresUserRepository::new(pool.clone()));
|
|
let product_service = PostgresProductService::new(postgres::PostgresProductRepository::new(pool));
|
|
|
|
let cli = Cli::try_parse()?;
|
|
cli.run(user_service, product_service).await
|
|
}
|