|
40 | 40 | useRedisCluster bool
|
41 | 41 | clusterAddrs string
|
42 | 42 | tlsServerName string
|
| 43 | + insecure bool |
43 | 44 | )
|
44 | 45 |
|
45 | 46 | // rootCmd represents the base command when called without any subcommands
|
@@ -314,13 +315,16 @@ func init() {
|
314 | 315 | "List of comma-separated redis server addresses")
|
315 | 316 | rootCmd.PersistentFlags().StringVar(&tlsServerName, "tls_server",
|
316 | 317 | "", "Server name for TLS validation")
|
| 318 | + rootCmd.PersistentFlags().BoolVar(&insecure, "insecure", |
| 319 | + false, "Allow insecure TLS connection by skipping cert validation") |
317 | 320 | // Bind flags with config.
|
318 | 321 | viper.BindPFlag("uri", rootCmd.PersistentFlags().Lookup("uri"))
|
319 | 322 | viper.BindPFlag("db", rootCmd.PersistentFlags().Lookup("db"))
|
320 | 323 | viper.BindPFlag("password", rootCmd.PersistentFlags().Lookup("password"))
|
321 | 324 | viper.BindPFlag("cluster", rootCmd.PersistentFlags().Lookup("cluster"))
|
322 | 325 | viper.BindPFlag("cluster_addrs", rootCmd.PersistentFlags().Lookup("cluster_addrs"))
|
323 | 326 | viper.BindPFlag("tls_server", rootCmd.PersistentFlags().Lookup("tls_server"))
|
| 327 | + viper.BindPFlag("insecure", rootCmd.PersistentFlags().Lookup("insecure")) |
324 | 328 | }
|
325 | 329 |
|
326 | 330 | // initConfig reads in config file and ENV variables if set.
|
@@ -402,7 +406,7 @@ func getTLSConfig() *tls.Config {
|
402 | 406 | if tlsServer == "" {
|
403 | 407 | return nil
|
404 | 408 | }
|
405 |
| - return &tls.Config{ServerName: tlsServer} |
| 409 | + return &tls.Config{ServerName: tlsServer, InsecureSkipVerify: viper.GetBool("insecure")} |
406 | 410 | }
|
407 | 411 |
|
408 | 412 | // printTable is a helper function to print data in table format.
|
|
0 commit comments