pass_manager/src/main.rs

26 lines
686 B
Rust

mod entity;
mod errors;
mod handlers;
mod models;
use anyhow::{Error, Result};
use dotenv::dotenv;
use futures::future::BoxFuture as PinnedFuture;
use handlers::get_dispatcher;
use migration::{Migrator, MigratorTrait};
use sea_orm::Database;
use std::env;
#[tokio::main]
async fn main() -> Result<()> {
let _ = dotenv();
pretty_env_logger::init();
let token = env::var("TOKEN").expect("expected TOKEN in the enviroment");
let database_url = env::var("DATABASE_URL").expect("expected DATABASE_URL in the enviroment");
let db = Database::connect(database_url).await?;
Migrator::up(&db, None).await?;
get_dispatcher(token, db).dispatch().await;
Ok(())
}