Documentation
¶
Index ¶
- func EnvToBool(key string, value bool) bool
- func EnvToInt(key string, value int64) int64
- func EnvToString(key string, value string) string
- func LoadConfigFromFile(filePath string, config interface{}) error
- func ParseConfigFilePath() string
- func SetupAllUpdateManagerFlags(flagSet *flag.FlagSet, cfg *Config)
- func SetupFlags(flagSet *flag.FlagSet, cfg *BaseConfig)
- type BaseConfig
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvToBool ¶
EnvToBool check if an ENV variable is set and returns its value as a bool. If not set, the default value is returned.
func EnvToInt ¶
EnvToInt check if an ENV variable is set and returns its value as an integer. If not set or value is not an integer, the default value is returned.
func EnvToString ¶
EnvToString check if an ENV variable is set and returns its value as a string. If not set, the default value is returned.
func LoadConfigFromFile ¶
LoadConfigFromFile reads the file contents and unmarshal them into the given config structure.
func ParseConfigFilePath ¶
func ParseConfigFilePath() string
ParseConfigFilePath returns the value for configuration file path if set.
func SetupAllUpdateManagerFlags ¶
SetupAllUpdateManagerFlags adds all flags for the configuration of the update manager
func SetupFlags ¶
func SetupFlags(flagSet *flag.FlagSet, cfg *BaseConfig)
SetupFlags adds common flags for the configuration of all update agents
Types ¶
type BaseConfig ¶
type BaseConfig struct {
Log *logger.LogConfig `json:"log,omitempty"`
MQTT *mqtt.ConnectionConfig `json:"connection,omitempty"`
Domain string `json:"domain,omitempty"`
ThingsEnabled bool `json:"thingsEnabled,omitempty"`
}
BaseConfig represents the common, reusable configuration that holds logger options and MQTT connection parameters.
func DefaultDomainConfig ¶
func DefaultDomainConfig(domain string) *BaseConfig
DefaultDomainConfig creates a new configuration filled with default values for all config properties and domain name set to the given parameter.
type Config ¶
type Config struct {
*BaseConfig
Agents map[string]*api.UpdateManagerConfig `json:"agents,omitempty"`
RebootEnabled bool `json:"rebootEnabled"`
RebootAfter string `json:"rebootAfter"`
ReportFeedbackInterval string `json:"reportFeedbackInterval"`
CurrentStateDelay string `json:"currentStateDelay"`
PhaseTimeout string `json:"phaseTimeout"`
OwnerConsentCommands []types.CommandType `json:"ownerConsentCommands"`
OwnerConsentTimeout string `json:"ownerConsentTimeout"`
}
Config represents the Update Manager configuration.
func LoadConfig ¶
LoadConfig loads a new configuration instance using flags and config file (if set).