1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-26 05:28:50 +00:00

Can load custom configuration

This commit is contained in:
Pierre HUBERT 2021-02-12 17:35:26 +01:00
parent 13bf916652
commit 05bcbc1f1a

View File

@ -2,12 +2,15 @@ use comunic_server::controllers::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("config.yaml").expect("Could not 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!");