From 05bcbc1f1a76ed88137a74c49e543c529a68956d Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 12 Feb 2021 17:35:26 +0100 Subject: [PATCH] Can load custom configuration --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 612f66d..3ad1933 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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!");