Skip to content

Commit 0290755

Browse files
feat(dash): Add --insecure option (#980)
1 parent 127fac2 commit 0290755

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/asynq/cmd/root.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ var (
4040
useRedisCluster bool
4141
clusterAddrs string
4242
tlsServerName string
43+
insecure bool
4344
)
4445

4546
// rootCmd represents the base command when called without any subcommands
@@ -314,13 +315,16 @@ func init() {
314315
"List of comma-separated redis server addresses")
315316
rootCmd.PersistentFlags().StringVar(&tlsServerName, "tls_server",
316317
"", "Server name for TLS validation")
318+
rootCmd.PersistentFlags().BoolVar(&insecure, "insecure",
319+
false, "Allow insecure TLS connection by skipping cert validation")
317320
// Bind flags with config.
318321
viper.BindPFlag("uri", rootCmd.PersistentFlags().Lookup("uri"))
319322
viper.BindPFlag("db", rootCmd.PersistentFlags().Lookup("db"))
320323
viper.BindPFlag("password", rootCmd.PersistentFlags().Lookup("password"))
321324
viper.BindPFlag("cluster", rootCmd.PersistentFlags().Lookup("cluster"))
322325
viper.BindPFlag("cluster_addrs", rootCmd.PersistentFlags().Lookup("cluster_addrs"))
323326
viper.BindPFlag("tls_server", rootCmd.PersistentFlags().Lookup("tls_server"))
327+
viper.BindPFlag("insecure", rootCmd.PersistentFlags().Lookup("insecure"))
324328
}
325329

326330
// initConfig reads in config file and ENV variables if set.
@@ -402,7 +406,7 @@ func getTLSConfig() *tls.Config {
402406
if tlsServer == "" {
403407
return nil
404408
}
405-
return &tls.Config{ServerName: tlsServer}
409+
return &tls.Config{ServerName: tlsServer, InsecureSkipVerify: viper.GetBool("insecure")}
406410
}
407411

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

0 commit comments

Comments
 (0)