2022-07-07 16:45:31 +00:00
|
|
|
use std::net::IpAddr;
|
2022-06-03 16:24:34 +00:00
|
|
|
use clap::Parser;
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref ARGS: Args = Args::parse();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Parser, Debug, Clone)]
|
|
|
|
#[clap(author, version, about, long_about = None)]
|
|
|
|
pub struct Args {
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_AUTH_USERNAME")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub auth_username: Option<String>,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_AUTH_PASSWORD")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub auth_password: Option<String>,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_EDITABLE")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub editable: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_FOOTER_TEXT")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub footer_text: Option<String>,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_HIDE_FOOTER")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub hide_footer: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_HIDE_HEADER")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub hide_header: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_HIDE_LOGO")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub hide_logo: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_NO_LISTING")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub no_listing: bool,
|
|
|
|
|
2022-07-20 07:13:31 +00:00
|
|
|
#[clap(long, env="MICROBIN_HIGHLIGHTSYNTAX")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub highlightsyntax: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(short, long, env="MICROBIN_PORT", default_value_t = 8080)]
|
2022-07-07 16:45:31 +00:00
|
|
|
pub port: u16,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(short, long, env="MICROBIN_BIND", default_value_t = IpAddr::from([0, 0, 0, 0]))]
|
2022-07-07 16:45:31 +00:00
|
|
|
pub bind: IpAddr,
|
2022-06-03 16:24:34 +00:00
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_PRIVATE")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub private: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_PURE_HTML")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub pure_html: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_READONLY")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub readonly: bool,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_TITLE")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub title: Option<String>,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(short, long, env="MICROBIN_THREADS", default_value_t = 1)]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub threads: u8,
|
|
|
|
|
2022-07-20 06:50:23 +00:00
|
|
|
#[clap(long, env="MICROBIN_WIDE")]
|
2022-06-03 16:24:34 +00:00
|
|
|
pub wide: bool,
|
2022-07-07 16:45:31 +00:00
|
|
|
}
|