diff --git a/Cargo.toml b/Cargo.toml index 50c60db..fa574c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3" -clap = { version = "4.0.32", features = ["cargo"] } +clap = { version = "4.0.32", features = ["cargo", "env"] } md5 = "0.7.0" scopeguard = "1.1.0" serde = "1.0" diff --git a/src/main.rs b/src/main.rs index aa76ce1..cce9718 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ fn main() -> Result<()> { .long("fingerprint") .value_name("FINGERPRINT") .help("Proxmox Backup Server Fingerprint") - .required(true), + .env("PBS_FINGERPRINT"), ) .arg( Arg::new("keyfile") @@ -72,9 +72,10 @@ fn main() -> Result<()> { let pbs_repository = matches.get_one::("repository").unwrap().to_string(); let vmid = matches.get_one::("vmid").unwrap().to_string(); + let fingerprint = matches .get_one::("fingerprint") - .unwrap() + .context("Fingerprint not set. Use $PBS_FINGERPRINT or --fingerprint")? .to_string(); let keyfile = matches.get_one::("keyfile");