Skip to content

Commit

Permalink
feat(dash): Add --insecure option (hibiken#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjoseph08 authored and divyam234 committed Dec 18, 2024
1 parent b44aafb commit 3b39166
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/asynq/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
useRedisCluster bool
clusterAddrs string
tlsServerName string
insecure bool
)

// rootCmd represents the base command when called without any subcommands
Expand Down Expand Up @@ -314,13 +315,16 @@ func init() {
"List of comma-separated redis server addresses")
rootCmd.PersistentFlags().StringVar(&tlsServerName, "tls_server",
"", "Server name for TLS validation")
rootCmd.PersistentFlags().BoolVar(&insecure, "insecure",
false, "Allow insecure TLS connection by skipping cert validation")
// Bind flags with config.
viper.BindPFlag("uri", rootCmd.PersistentFlags().Lookup("uri"))
viper.BindPFlag("db", rootCmd.PersistentFlags().Lookup("db"))
viper.BindPFlag("password", rootCmd.PersistentFlags().Lookup("password"))
viper.BindPFlag("cluster", rootCmd.PersistentFlags().Lookup("cluster"))
viper.BindPFlag("cluster_addrs", rootCmd.PersistentFlags().Lookup("cluster_addrs"))
viper.BindPFlag("tls_server", rootCmd.PersistentFlags().Lookup("tls_server"))
viper.BindPFlag("insecure", rootCmd.PersistentFlags().Lookup("insecure"))
}

// initConfig reads in config file and ENV variables if set.
Expand Down Expand Up @@ -402,7 +406,7 @@ func getTLSConfig() *tls.Config {
if tlsServer == "" {
return nil
}
return &tls.Config{ServerName: tlsServer}
return &tls.Config{ServerName: tlsServer, InsecureSkipVerify: viper.GetBool("insecure")}
}

// printTable is a helper function to print data in table format.
Expand Down

0 comments on commit 3b39166

Please sign in to comment.