Documentation
¶
Overview ¶
Package config contains the configuration for the minder cli and server
Index ¶
- func BindConfigFlag[V any](v *viper.Viper, flags *pflag.FlagSet, viperPath string, cmdLineArg string, ...) error
- func BindConfigFlagWithShort[V any](v *viper.Viper, flags *pflag.FlagSet, viperPath string, cmdLineArg string, ...) error
- func GetConfigFileData(cfgFile, defaultCfgPath string) (interface{}, error)
- func GetKeysWithNullValueFromYAML(data interface{}, currentPath string) []string
- func ReadConfigFromViper[CFG any](v *viper.Viper) (*CFG, error)
- func RegisterDatabaseFlags(v *viper.Viper, flags *pflag.FlagSet) error
- func RegisterGRPCClientConfigFlags(v *viper.Viper, flags *pflag.FlagSet) error
- type DatabaseConfig
- type FlagInst
- type FlagInstShort
- type GRPCClientConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindConfigFlag ¶ added in v0.0.22
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.
Parameters: - 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 ¶ added in v0.0.22
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.
Parameters: - 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.
func GetConfigFileData ¶ added in v0.0.24
GetConfigFileData returns the data from the given configuration file.
func GetKeysWithNullValueFromYAML ¶ added in v0.0.24
GetKeysWithNullValueFromYAML returns a list of paths to null values in the given configuration data.
func ReadConfigFromViper ¶
ReadConfigFromViper reads the configuration from the given Viper instance. This will return the already-parsed and validated configuration, or an error.
func RegisterDatabaseFlags ¶
RegisterDatabaseFlags registers the flags for the database configuration
Types ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `mapstructure:"dbhost" default:"localhost"`
Port int `mapstructure:"dbport" default:"5432"`
User string `mapstructure:"dbuser" default:"postgres"`
Password string `mapstructure:"dbpass" default:"postgres"`
Name string `mapstructure:"dbname" default:"minder"`
SSLMode string `mapstructure:"sslmode" default:"disable"`
}
DatabaseConfig is the configuration for the database
func (*DatabaseConfig) GetDBConnection ¶
GetDBConnection returns a connection to the database
type FlagInst ¶ added in v0.0.22
FlagInst is a function that creates a flag and returns a pointer to the value
type FlagInstShort ¶ added in v0.0.22
FlagInstShort is a function that creates a flag and returns a pointer to the value
type GRPCClientConfig ¶ added in v0.0.31
type GRPCClientConfig struct {
// Host is the host to connect to
Host string `mapstructure:"host" default:"api.stacklok.com"`
// Port is the port to connect to
Port int `mapstructure:"port" default:"443"`
// Insecure is whether to allow establishing insecure connections
Insecure bool `mapstructure:"insecure" default:"false"`
}
GRPCClientConfig is the configuration for a service to connect to minder gRPC server
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client contains the configuration for the minder cli
|
Package client contains the configuration for the minder cli |
|
Package server contains a centralized structure for all configuration options.
|
Package server contains a centralized structure for all configuration options. |