From 12f0e8f3a7188f51720cf5aac41aab9666b71e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Fri, 1 Mar 2024 22:17:17 +0300 Subject: [PATCH] chore(server): gracefully exit when there is no config file found --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index f03d682..f519c46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,6 +61,13 @@ fn setup(config_folder: &Path) -> IoResult<(Data>, ServerConfig, } None => config_folder.join("config.toml"), }; + if !config_path.exists() { + error!( + "{} is not found, please provide a configuration file.", + config_path.display() + ); + std::process::exit(1); + } let config = Config::parse(&config_path).expect("failed to parse config"); trace!("{:#?}", config); config.warn_deprecation();