Merge pull request #34 from uniqueNullptr2/uniquenullptr2-add-config-from-env

add configuration from env to all clap options
This commit is contained in:
Dániel Szabó 2022-07-25 14:04:26 +01:00 committed by GitHub
commit d4d94b61da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View file

@ -24,7 +24,7 @@ askama-filters={ version = "0.1.3", features = ["chrono"] }
chrono="0.4.19"
rand="0.8.5"
linkify="0.8.1"
clap={ version = "3.1.12", features = ["derive"] }
clap={ version = "3.1.12", features = ["derive", "env"] }
actix-multipart = "0.4.0"
futures = "0.3"
sanitize-filename = "0.3.0"

View file

@ -9,54 +9,54 @@ lazy_static! {
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about, long_about = None)]
pub struct Args {
#[clap(long)]
#[clap(long, env="MICROBIN_AUTH_USERNAME")]
pub auth_username: Option<String>,
#[clap(long)]
#[clap(long, env="MICROBIN_AUTH_PASSWORD")]
pub auth_password: Option<String>,
#[clap(long)]
#[clap(long, env="MICROBIN_EDITABLE")]
pub editable: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_FOOTER_TEXT")]
pub footer_text: Option<String>,
#[clap(long)]
#[clap(long, env="MICROBIN_HIDE_FOOTER")]
pub hide_footer: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_HIDE_HEADER")]
pub hide_header: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_HIDE_LOGO")]
pub hide_logo: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_NO_LISTING")]
pub no_listing: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_HIGHLIGHTSYNTAX")]
pub highlightsyntax: bool,
#[clap(short, long, default_value_t = 8080)]
#[clap(short, long, env="MICROBIN_PORT", default_value_t = 8080)]
pub port: u16,
#[clap(short, long, default_value_t = IpAddr::from([0, 0, 0, 0]))]
#[clap(short, long, env="MICROBIN_BIND", default_value_t = IpAddr::from([0, 0, 0, 0]))]
pub bind: IpAddr,
#[clap(long)]
#[clap(long, env="MICROBIN_PRIVATE")]
pub private: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_PURE_HTML")]
pub pure_html: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_READONLY")]
pub readonly: bool,
#[clap(long)]
#[clap(long, env="MICROBIN_TITLE")]
pub title: Option<String>,
#[clap(short, long, default_value_t = 1)]
#[clap(short, long, env="MICROBIN_THREADS", default_value_t = 1)]
pub threads: u8,
#[clap(long)]
#[clap(long, env="MICROBIN_WIDE")]
pub wide: bool,
}