1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-30 15:38:52 +00:00
comunicapiv3/src/main.rs
2021-03-02 19:00:14 +01:00

24 lines
706 B
Rust

use comunic_server::{cleanup_thread, server};
use comunic_server::data::config::{conf, Config};
use comunic_server::helpers::database;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
let conf_file = match std::env::args().skip(1).next() {
Some(el) => el,
None => "config.yaml".to_string(),
};
// Load configuration
Config::load(&conf_file).expect("Could not load configuration!");
// Connect to the database
database::connect(&conf().database).expect("Could not connect to database!");
// Start cleanup thread
cleanup_thread::start().expect("Failed to start cleanup thread!");
// Start the server
server::start_server(conf()).await
}