| 15 | |
| 16 | /// Exit code for a bad configuration, distinct from a runtime crash. |
| 17 | const CONFIG_ERROR_EXIT: u8 = 2; |
| 18 | |
| 19 | #[derive(Debug, Parser)] |
| 20 | struct Args { |
| 21 | /// Path to the configuration file. Without one the daemon runs on defaults |
| 22 | #[clap(short, long)] |
| 23 | configuration: Option<PathBuf>, |
| 24 | |
| 25 | /// Raise the stdout level from `info` to `debug`. |
| 26 | #[clap(short, long)] |
| 27 | verbose: bool, |
| 28 | |
| 29 | /// Load, parse, and validate the configuration, report the outcome, and exit without |
| 30 | /// starting the daemon. |
| 31 | #[clap(long, requires = "configuration")] |
| 32 | check_configuration: bool, |
| 33 | } |
| 34 | |
| 35 | #[tokio::main(flavor = "multi_thread", worker_threads = 4)] |
| 36 | async fn main() { |
| 37 | let args = Args::parse(); |
| 38 | |
| 39 | // Load and validate the configuration before anything is set up, so a bad one |
| 40 | // reports its cause and stops here. |