Skip to content

Commit

Permalink
Bind to persistent flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Valdemar Lubenets committed Mar 17, 2021
1 parent befadb8 commit fc3111a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ func init() {
serverCmd.PersistentFlags().Int("port", 8080, "port to run the Seastat server on (for Prometheus to scrape)")
serverCmd.PersistentFlags().Duration("timeout", 3*time.Second, "how long before we timeout a Jolokia request")
serverCmd.PersistentFlags().Int("concurrency", 10, "maximum number of concurrent requests to Jolokia")
viper.BindPFlag("endpoint", serverCmd.Flags().Lookup("endpoint"))
viper.BindPFlag("interval", serverCmd.Flags().Lookup("interval"))
viper.BindPFlag("port", serverCmd.Flags().Lookup("port"))
viper.BindPFlag("timeout", serverCmd.Flags().Lookup("timeout"))
viper.BindPFlag("concurrency", serverCmd.Flags().Lookup("concurrency"))

viper.BindPFlag("endpoint", serverCmd.PersistentFlags().Lookup("endpoint"))
viper.BindPFlag("interval", serverCmd.PersistentFlags().Lookup("interval"))
viper.BindPFlag("port", serverCmd.PersistentFlags().Lookup("port"))
viper.BindPFlag("timeout", serverCmd.PersistentFlags().Lookup("timeout"))
viper.BindPFlag("concurrency", serverCmd.PersistentFlags().Lookup("concurrency"))
}

func run(cmd *cobra.Command) {
Expand Down

0 comments on commit fc3111a

Please sign in to comment.