Switch to async Rust and break all logic.

This commit is contained in:
Paul Makles
2020-12-27 13:28:37 +00:00
parent 5711986768
commit 6cfec0ee08
26 changed files with 1141 additions and 1256 deletions

View File

@@ -1,4 +1,5 @@
#![feature(proc_macro_hygiene, decl_macro)]
#![feature(async_closure)]
#[macro_use]
extern crate rocket;
@@ -17,17 +18,18 @@ pub mod util;
use log::info;
use rocket_cors::AllowedOrigins;
fn main() {
#[tokio::main]
async fn main() {
dotenv::dotenv().ok();
env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "info"));
info!("Starting REVOLT server.");
util::variables::preflight_checks();
database::connect();
database::connect().await;
pubsub::hive::init_hive();
pubsub::websocket::launch_server();
//pubsub::websocket::launch_server();
let cors = rocket_cors::CorsOptions {
allowed_origins: AllowedOrigins::All,
@@ -36,5 +38,9 @@ fn main() {
.to_cors()
.unwrap();
routes::mount(rocket::ignite()).attach(cors).launch();
routes::mount(rocket::ignite())
.attach(cors)
.launch()
.await
.unwrap();
}