maia_httpd/args.rs
1//! maia-httpd CLI arguments.
2//!
3//! This module contains the definition of the CLI arguments for the maia-httpd
4//! application.
5
6use clap::Parser;
7use std::{net::SocketAddr, path::PathBuf};
8
9/// maia-httpd CLI arguments.
10#[derive(Parser, Debug, Clone, Eq, PartialEq, Hash)]
11#[clap(author, version, about, long_about = None)]
12pub struct Args {
13 /// Listen address for the HTTP server
14 #[clap(long, default_value = "0.0.0.0:8000")]
15 pub listen: SocketAddr,
16 /// Listen address for the HTTPS server
17 #[clap(long, default_value = "0.0.0.0:443")]
18 pub listen_https: SocketAddr,
19 /// Path to SSL certificate for HTTPS server
20 ///
21 /// Unless both the SSL certificate and key are specified, the HTTPS server
22 /// is disabled.
23 #[clap(long)]
24 pub ssl_cert: Option<PathBuf>,
25 /// Path to SSL key for HTTPS server
26 ///
27 /// Unless both the SSL certificate and key are specified, the HTTPS server
28 /// is disabled.
29 #[clap(long)]
30 pub ssl_key: Option<PathBuf>,
31 /// Path to CA certificate for HTTPS server
32 ///
33 /// The CA certificate is accessible on /ca.crt of the web API if this
34 /// option is provided.
35 #[clap(long)]
36 pub ca_cert: Option<PathBuf>,
37}
38
39#[cfg(feature = "uclibc")]
40impl Default for Args {
41 fn default() -> Args {
42 Args {
43 listen: "0.0.0.0:8000".parse().unwrap(),
44 listen_https: "0.0.0.0:443".parse().unwrap(),
45 ssl_cert: None,
46 ssl_key: None,
47 ca_cert: None,
48 }
49 }
50}