Documentation ¶
Index ¶
Constants ¶
View Source
const ( Black uint8 = iota + 30 Red Green Yellow Blue Magenta Cyan White )
Foreground colors.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { //Viper uses the mapstructure package under the hood for unmarshaling values. ServerURL string `mapstructure:"MQTT_SERVER_URL"` User string `mapstructure:"MQTT_SERVER_USER"` Pwd string `mapstructure:"MQTT_SERVER_PWD"` Retain bool `mapstructure:"MQTT_SERVER_RETAIN"` Qos byte `mapstructure:"MQTT_SERVER_QOS"` ClientID string `mapstructure:"MQTT_CLIENT_ID"` KeepAlive uint16 `mapstructure:"MQTT_KEEP_ALIVE"` RetryDelay uint16 `mapstructure:"MQTT_RETRY_DELAY"` Area string `mapstructure:"AREA"` Site string `mapstructure:"SITE"` RandomDelayBetweenMessages bool `mapstructure:"RANDOM_DELAY_BETWEEN_MESSAGES"` DelayBetweenMessagesMin uint16 `mapstructure:"DELAY_BETWEEN_MESSAGES_MIN"` DelayBetweenMessagesMax uint16 `mapstructure:"DELAY_BETWEEN_MESSAGES_MAX"` GeneratorsNumber int `mapstructure:"GENERATORS_NUMBER"` GeneratorsLimitNumber int `mapstructure:"GENERATORS_NUMBER_LIMIT"` }
This Config struct will hold all configuration variables of the application that we read from file or environment variables.
func NewConfig ¶
func NewConfig(logger *zap.SugaredLogger) *Config
func (*Config) LoadConfig ¶
func (config *Config) LoadConfig(logger *zap.SugaredLogger)
LoadConfig reads configuration from file or environment variables.
Click to show internal directories.
Click to hide internal directories.