src/bin/proxmox-backup-client.rs: allows to pass fingerprint via env vars
This commit is contained in:
parent
b69b8af26b
commit
a05c0c6ff6
@ -36,6 +36,8 @@ use xdg::BaseDirectories;
|
|||||||
use futures::*;
|
use futures::*;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
|
const ENV_VAR_PBS_FINGERPRINT: &str = "PBS_FINGERPRINT";
|
||||||
|
|
||||||
proxmox::const_regex! {
|
proxmox::const_regex! {
|
||||||
BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$";
|
BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$";
|
||||||
}
|
}
|
||||||
@ -166,10 +168,13 @@ fn complete_repository(_arg: &str, _param: &HashMap<String, String>) -> Vec<Stri
|
|||||||
|
|
||||||
fn connect(server: &str, userid: &str) -> Result<HttpClient, Error> {
|
fn connect(server: &str, userid: &str) -> Result<HttpClient, Error> {
|
||||||
|
|
||||||
|
let fingerprint = std::env::var(ENV_VAR_PBS_FINGERPRINT).ok();
|
||||||
|
|
||||||
let options = HttpClientOptions::new()
|
let options = HttpClientOptions::new()
|
||||||
.prefix(Some("proxmox-backup".to_string()))
|
.prefix(Some("proxmox-backup".to_string()))
|
||||||
.password_env(Some("PBS_PASSWORD".to_string()))
|
.password_env(Some("PBS_PASSWORD".to_string()))
|
||||||
.interactive(true)
|
.interactive(true)
|
||||||
|
.fingerprint(fingerprint)
|
||||||
.fingerprint_cache(true)
|
.fingerprint_cache(true)
|
||||||
.ticket_cache(true);
|
.ticket_cache(true);
|
||||||
|
|
||||||
@ -1477,10 +1482,13 @@ async fn status(param: Value) -> Result<Value, Error> {
|
|||||||
// like get, but simply ignore errors and return Null instead
|
// like get, but simply ignore errors and return Null instead
|
||||||
async fn try_get(repo: &BackupRepository, url: &str) -> Value {
|
async fn try_get(repo: &BackupRepository, url: &str) -> Value {
|
||||||
|
|
||||||
|
let fingerprint = std::env::var(ENV_VAR_PBS_FINGERPRINT).ok();
|
||||||
|
|
||||||
let options = HttpClientOptions::new()
|
let options = HttpClientOptions::new()
|
||||||
.prefix(Some("proxmox-backup".to_string()))
|
.prefix(Some("proxmox-backup".to_string()))
|
||||||
.password_env(Some("PBS_PASSWORD".to_string()))
|
.password_env(Some("PBS_PASSWORD".to_string()))
|
||||||
.interactive(false)
|
.interactive(false)
|
||||||
|
.fingerprint(fingerprint)
|
||||||
.fingerprint_cache(true)
|
.fingerprint_cache(true)
|
||||||
.ticket_cache(true);
|
.ticket_cache(true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user