Documentation ¶
Overview ¶
Package viperconfig is a fancy interface allowing you to bind viper commands in your individual packages without having to make some insane monolithic file Credit goes to the stacklok folks: https://github.com/stacklok/minder/blob/main/internal/util/configutils.go TO DO: convert allthethings over to using utils.BindConfigFlag()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindConfigFlag ¶
func BindConfigFlag[V any]( v *viper.Viper, flags *pflag.FlagSet, viperPath string, cmdLineArg string, defaultValue V, help string, binder FlagInst[V], ) error
BindConfigFlag is a helper function that binds a configuration value to a flag v: The viper.Viper object used to retrieve the configuration value flags: The pflag.FlagSet object used to retrieve the flag value viperPath: The path used to retrieve the configuration value from Viper cmdLineArg: The flag name used to check if the flag has been set and to retrieve its value help: The help text for the flag defaultValue: A default value used to determine the type of the flag (string, int, etc.) binder: A function that creates a flag and returns a pointer to the value
func BindConfigFlagWithShort ¶
func BindConfigFlagWithShort[V any]( v *viper.Viper, flags *pflag.FlagSet, viperPath string, cmdLineArg string, short string, defaultValue V, help string, binder FlagInstShort[V], ) error
BindConfigFlagWithShort is a helper function that binds a configuration value to a flag v: The viper.Viper object used to retrieve the configuration value flags: The pflag.FlagSet object used to retrieve the flag value viperPath: The path used to retrieve the configuration value from Viper cmdLineArg: The flag name used to check if the flag has been set and to retrieve its value short: The short name for the flag help: The help text for the flag defaultValue: A default value used to determine the type of the flag (string, int, etc.) binder: A function that creates a flag and returns a pointer to the value
Types ¶
type FlagInstShort ¶
FlagInstShort is a function that creates a flag and returns a pointer