@@ -31,15 +31,17 @@ pub struct Config {
3131
3232impl Config {
3333 fn get_client ( & self ) -> Result < Client , Box < dyn Error > > {
34- let ( host_url, auth_token, ca_cert) = match & self . cmd {
34+ let ( host_url, auth_token, ca_cert, tls_no_verify ) = match & self . cmd {
3535 SubCommand :: Database ( DatabaseConfig {
3636 host_url,
3737 auth_token,
3838 ca_cert,
39+ tls_no_verify,
3940 ..
4041 } )
4142 | SubCommand :: LastCache ( LastCacheConfig {
4243 ca_cert,
44+ tls_no_verify,
4345 influxdb3_config :
4446 InfluxDb3Config {
4547 host_url,
@@ -50,6 +52,7 @@ impl Config {
5052 } )
5153 | SubCommand :: DistinctCache ( DistinctCacheConfig {
5254 ca_cert,
55+ tls_no_verify,
5356 influxdb3_config :
5457 InfluxDb3Config {
5558 host_url,
@@ -60,6 +63,7 @@ impl Config {
6063 } )
6164 | SubCommand :: Table ( TableConfig {
6265 ca_cert,
66+ tls_no_verify,
6367 influxdb3_config :
6468 InfluxDb3Config {
6569 host_url,
@@ -70,21 +74,23 @@ impl Config {
7074 } )
7175 | SubCommand :: Trigger ( TriggerConfig {
7276 ca_cert,
77+ tls_no_verify,
7378 influxdb3_config :
7479 InfluxDb3Config {
7580 host_url,
7681 auth_token,
7782 ..
7883 } ,
7984 ..
80- } ) => ( host_url, auth_token, ca_cert) ,
85+ } ) => ( host_url, auth_token, ca_cert, tls_no_verify ) ,
8186 SubCommand :: Token ( create_token_config) => {
8287 let host_settings = create_token_config. get_connection_settings ( ) ?;
8388 // We need to return references, so we'll handle this differently
8489 return Ok ( {
8590 let mut client = Client :: new (
8691 host_settings. host_url . clone ( ) ,
8792 host_settings. ca_cert . clone ( ) ,
93+ host_settings. tls_no_verify ,
8894 ) ?;
8995 if let Some ( token) = & host_settings. auth_token {
9096 client = client. with_auth_token ( token. expose_secret ( ) ) ;
@@ -94,7 +100,7 @@ impl Config {
94100 }
95101 } ;
96102
97- let mut client = Client :: new ( host_url. clone ( ) , ca_cert. clone ( ) ) ?;
103+ let mut client = Client :: new ( host_url. clone ( ) , ca_cert. clone ( ) , * tls_no_verify ) ?;
98104 if let Some ( token) = & auth_token {
99105 client = client. with_auth_token ( token. expose_secret ( ) ) ;
100106 }
@@ -147,6 +153,10 @@ pub struct DatabaseConfig {
147153 /// An optional arg to use a custom ca for useful for testing with self signed certs
148154 #[ clap( long = "tls-ca" , env = "INFLUXDB3_TLS_CA" ) ]
149155 ca_cert : Option < PathBuf > ,
156+
157+ /// Disable TLS certificate verification
158+ #[ clap( long = "tls-no-verify" , env = "INFLUXDB3_TLS_NO_VERIFY" ) ]
159+ tls_no_verify : bool ,
150160}
151161
152162#[ derive( Debug , clap:: Args ) ]
@@ -190,6 +200,10 @@ pub struct LastCacheConfig {
190200 /// An optional arg to use a custom ca for useful for testing with self signed certs
191201 #[ clap( long = "tls-ca" , env = "INFLUXDB3_TLS_CA" ) ]
192202 ca_cert : Option < PathBuf > ,
203+
204+ /// Disable TLS certificate verification
205+ #[ clap( long = "tls-no-verify" , env = "INFLUXDB3_TLS_NO_VERIFY" ) ]
206+ tls_no_verify : bool ,
193207}
194208
195209#[ derive( Debug , clap:: Args ) ]
@@ -227,6 +241,10 @@ pub struct DistinctCacheConfig {
227241 /// An optional arg to use a custom ca for useful for testing with self signed certs
228242 #[ clap( long = "tls-ca" , env = "INFLUXDB3_TLS_CA" ) ]
229243 ca_cert : Option < PathBuf > ,
244+
245+ /// Disable TLS certificate verification
246+ #[ clap( long = "tls-no-verify" , env = "INFLUXDB3_TLS_NO_VERIFY" ) ]
247+ tls_no_verify : bool ,
230248}
231249
232250#[ derive( Debug , clap:: Args ) ]
@@ -250,6 +268,10 @@ pub struct TableConfig {
250268 /// An optional arg to use a custom ca for useful for testing with self signed certs
251269 #[ clap( long = "tls-ca" , env = "INFLUXDB3_TLS_CA" ) ]
252270 ca_cert : Option < PathBuf > ,
271+
272+ /// Disable TLS certificate verification
273+ #[ clap( long = "tls-no-verify" , env = "INFLUXDB3_TLS_NO_VERIFY" ) ]
274+ tls_no_verify : bool ,
253275}
254276
255277#[ derive( Debug , clap:: Parser ) ]
@@ -291,6 +313,10 @@ pub struct TriggerConfig {
291313 /// An optional arg to use a custom ca for useful for testing with self signed certs
292314 #[ clap( long = "tls-ca" , env = "INFLUXDB3_TLS_CA" ) ]
293315 ca_cert : Option < PathBuf > ,
316+
317+ /// Disable TLS certificate verification
318+ #[ clap( long = "tls-no-verify" , env = "INFLUXDB3_TLS_NO_VERIFY" ) ]
319+ tls_no_verify : bool ,
294320}
295321
296322pub async fn command ( config : Config ) -> Result < ( ) , Box < dyn Error > > {
0 commit comments