mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 09:34:04 +00:00 
			
		
		
		
	Can load custom configuration
This commit is contained in:
		@@ -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!");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user