Skip to content

Commit

Permalink
operator: fix viper bindings
Browse files Browse the repository at this point in the history
Signed-off-by: Kornilios Kourtis <[email protected]>
  • Loading branch information
kkourt committed Oct 12, 2023
1 parent 2c61d4c commit e3f180f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion operator/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func New() *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {
common.Initialize(cmd)
},
PreRunE: func(cmd *cobra.Command, _ []string) error {
return viper.BindPFlags(cmd.Flags())
},
}

cobra.OnInitialize(func() {
Expand All @@ -48,7 +51,6 @@ func New() *cobra.Command {
})

common.AddCommonFlags(rootCmd)
viper.BindPFlags(rootCmd.Flags())
rootCmd.AddCommand(serve.New())
return rootCmd
}

0 comments on commit e3f180f

Please sign in to comment.