Documentation ¶
Index ¶
- Constants
- Variables
- func BundleHelpMsg(cfg *Config) string
- func GetNetworkMode(config Storage) network.Mode
- func GetPreset(config Storage) preset.Preset
- func RegisterSettings(cfg *Config)
- func RequiresCRCSetup(key string, _ interface{}) string
- func RequiresCleanupAndSetupMsg(key string, _ interface{}) string
- func RequiresDeleteAndSetupMsg(key string, _ interface{}) string
- func RequiresDeleteMsg(key string, _ interface{}) string
- func RequiresHTTPPortChangeWarning(key string, value interface{}) string
- func RequiresHTTPSPortChangeWarning(key string, value interface{}) string
- func RequiresRestartMsg(key string, _ interface{}) string
- func SuccessfullyApplied(key string, value interface{}) string
- func UpdateDefaults(cfg *Config)
- func ValidateBool(value interface{}) (bool, string)
- type Config
- func (c *Config) AddSetting(name string, defValue interface{}, validationFn ValidationFnType, ...)
- func (c *Config) AllConfigs() map[string]SettingValue
- func (c *Config) AllSettings() []Setting
- func (c *Config) Get(key string) SettingValue
- func (c *Config) RegisterNotifier(key string, changeNotifier ValueChangedFunc) error
- func (c *Config) Set(key string, value interface{}) (string, error)
- func (c *Config) Unset(key string) (string, error)
- type InMemoryStorage
- type Path
- type RawStorage
- type Schema
- type Secret
- type SecretStorage
- type SetFn
- type Setting
- type SettingValue
- type Storage
- type ValidationFnType
- type ValueChangedFunc
- type ViperStorage
Constants ¶
View Source
const ( Bundle = "bundle" CPUs = "cpus" Memory = "memory" DiskSize = "disk-size" NameServer = "nameserver" PullSecretFile = "pull-secret-file" DisableUpdateCheck = "disable-update-check" ExperimentalFeatures = "enable-experimental-features" NetworkMode = "network-mode" HostNetworkAccess = "host-network-access" HTTPProxy = "http-proxy" HTTPSProxy = "https-proxy" NoProxy = "no-proxy" ProxyCAFile = "proxy-ca-file" ConsentTelemetry = "consent-telemetry" EnableClusterMonitoring = "enable-cluster-monitoring" KubeAdminPassword = "kubeadmin-password" Preset = "preset" IngressHTTPPort = "ingress-http-port" IngressHTTPSPort = "ingress-https-port" EmergencyLogin = "enable-emergency-login" PersistentVolumeSize = "persistent-volume-size" EnableBundleQuayFallback = "enable-bundle-quay-fallback" )
Variables ¶
View Source
var ErrSecretsNotAccessible = errors.New("secret store is not accessible")
Functions ¶
func BundleHelpMsg ¶
func GetNetworkMode ¶
func RegisterSettings ¶
func RegisterSettings(cfg *Config)
func RequiresCRCSetup ¶
func RequiresDeleteMsg ¶
func RequiresRestartMsg ¶
func SuccessfullyApplied ¶
func UpdateDefaults ¶
func UpdateDefaults(cfg *Config)
func ValidateBool ¶
ValidateBool is a fail safe in the case user makes a typo for boolean config values
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func New ¶
func New(storage, secretStorage RawStorage) *Config
func (*Config) AddSetting ¶
func (c *Config) AddSetting(name string, defValue interface{}, validationFn ValidationFnType, callbackFn SetFn, help string)
AddSetting returns a filled struct of ConfigSetting takes the config name and default value as arguments
func (*Config) AllConfigs ¶
func (c *Config) AllConfigs() map[string]SettingValue
AllConfigs returns all the known configs A known config is one which was registered through AddSetting - config with a default value - config with a value set - config with no value set
func (*Config) AllSettings ¶
func (*Config) Get ¶
func (c *Config) Get(key string) SettingValue
func (*Config) RegisterNotifier ¶
func (c *Config) RegisterNotifier(key string, changeNotifier ValueChangedFunc) error
type InMemoryStorage ¶
type InMemoryStorage struct {
// contains filtered or unexported fields
}
func NewEmptyInMemoryStorage ¶
func NewEmptyInMemoryStorage() *InMemoryStorage
func NewInMemoryStorage ¶
func NewInMemoryStorage(init map[string]interface{}) *InMemoryStorage
func (*InMemoryStorage) Get ¶
func (s *InMemoryStorage) Get(key string) interface{}
func (*InMemoryStorage) Set ¶
func (s *InMemoryStorage) Set(key string, value interface{}) error
func (*InMemoryStorage) Unset ¶
func (s *InMemoryStorage) Unset(key string) error
type RawStorage ¶
type RawStorage interface { Get(key string) interface{} Set(key string, value interface{}) error Unset(key string) error }
RawStorage stores any key-value pair without validation
type Schema ¶
type Schema interface {
AddSetting(name string, defValue interface{}, validationFn ValidationFnType, callbackFn SetFn, help string)
}
type SecretStorage ¶
type SecretStorage struct {
// contains filtered or unexported fields
}
func NewEmptyInMemorySecretStorage ¶
func NewEmptyInMemorySecretStorage() *SecretStorage
func NewSecretStorage ¶
func NewSecretStorage() *SecretStorage
func (*SecretStorage) Get ¶
func (c *SecretStorage) Get(key string) interface{}
func (*SecretStorage) Set ¶
func (c *SecretStorage) Set(key string, value interface{}) error
func (*SecretStorage) Unset ¶
func (c *SecretStorage) Unset(key string) error
type SettingValue ¶
func (SettingValue) AsBool ¶
func (v SettingValue) AsBool() bool
func (SettingValue) AsInt ¶
func (v SettingValue) AsInt() int
func (SettingValue) AsString ¶
func (v SettingValue) AsString() string
func (SettingValue) AsUInt ¶
func (v SettingValue) AsUInt() uint
type Storage ¶
type Storage interface { Get(key string) SettingValue Set(key string, value interface{}) (string, error) Unset(key string) (string, error) AllConfigs() map[string]SettingValue }
type ValidationFnType ¶
validationFnType takes the key, value as args and checks if valid
type ValueChangedFunc ¶
type ViperStorage ¶
type ViperStorage struct {
// contains filtered or unexported fields
}
func NewViperStorage ¶
func NewViperStorage(configFile, envPrefix string) (*ViperStorage, error)
func (*ViperStorage) BindFlagSet ¶
func (c *ViperStorage) BindFlagSet(flagSet *pflag.FlagSet) error
BindFlagset binds a flagset to their respective config properties
func (*ViperStorage) Get ¶
func (c *ViperStorage) Get(key string) interface{}
func (*ViperStorage) Set ¶
func (c *ViperStorage) Set(key string, value interface{}) error
func (*ViperStorage) Unset ¶
func (c *ViperStorage) Unset(key string) error
Click to show internal directories.
Click to hide internal directories.