From 4ab928133a1c33db5d42d678ef0ab20a5dc5743f Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Thu, 16 Dec 2021 11:31:53 -0800 Subject: [PATCH] feat(client): add insecure flag Add insecure flag for ignoring certificate errors. --- bin/client/main.rs | 6 ++++-- bin/client/opts.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/client/main.rs b/bin/client/main.rs index 25a812e..d2d4d24 100644 --- a/bin/client/main.rs +++ b/bin/client/main.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use bindle::client::{ tokens::{HttpBasic, NoToken, OidcToken, TokenManager}, - Client, ClientError, Result, + Client, ClientBuilder, ClientError, Result, }; use bindle::invoice::signature::{ KeyRing, SecretKeyEntry, SecretKeyFile, SecretKeyStorage, SignatureRole, @@ -126,7 +126,9 @@ async fn run() -> std::result::Result<(), ClientError> { PickYourAuth::None(NoToken) }; - let bindle_client = Client::new(&opts.server_url, token)?; + let bindle_client = ClientBuilder::default() + .danger_accept_invalid_certs(opts.insecure) + .build(&opts.server_url, token)?; let local = bindle::provider::file::FileProvider::new( bindle_dir, diff --git a/bin/client/opts.rs b/bin/client/opts.rs index 52af725..5608c6e 100644 --- a/bin/client/opts.rs +++ b/bin/client/opts.rs @@ -59,6 +59,14 @@ pub struct Opts { )] pub http_password: Option, + #[clap( + short = 'k', + long = "insecure", + about = "If set, ignore server certificate errors", + takes_value = false + )] + pub insecure: bool, + #[clap(subcommand)] pub subcmd: SubCommand, }