2023-06-01 11:42:35 +00:00
|
|
|
use anyhow::Result;
|
2023-04-24 17:48:34 +00:00
|
|
|
use dotenv::dotenv;
|
2023-04-27 13:25:23 +00:00
|
|
|
use migration::{Migrator, MigratorTrait};
|
2023-06-01 11:42:35 +00:00
|
|
|
use pass_manager::get_dispatcher;
|
2023-04-27 13:25:23 +00:00
|
|
|
use sea_orm::Database;
|
2023-05-15 16:09:15 +00:00
|
|
|
use std::env;
|
2023-04-24 17:48:34 +00:00
|
|
|
|
|
|
|
#[tokio::main]
|
2023-04-27 13:25:23 +00:00
|
|
|
async fn main() -> Result<()> {
|
2023-04-24 17:48:34 +00:00
|
|
|
let _ = dotenv();
|
|
|
|
pretty_env_logger::init();
|
|
|
|
|
2023-05-06 17:20:33 +00:00
|
|
|
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");
|
2023-04-27 13:25:23 +00:00
|
|
|
let db = Database::connect(database_url).await?;
|
|
|
|
Migrator::up(&db, None).await?;
|
|
|
|
get_dispatcher(token, db).dispatch().await;
|
|
|
|
Ok(())
|
2023-04-23 17:54:16 +00:00
|
|
|
}
|