config

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BotName = "gobot_pir"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Placement    string `json:"placement,omitempty"`
	MetricConfig string `json:"metrics_addr,omitempty"`
	IntervalSecs int    `json:"interval_s,omitempty"`
	LogSensor    bool   `json:"log_sensor,omitempty"`
	MessageOn    string `json:"message_on"`
	MessageOff   string `json:"message_off"`
	MqttConfig
	SensorConfig
}

func ConfigFromEnv

func ConfigFromEnv() Config

func DefaultConfig

func DefaultConfig() Config

func ReadJsonConfig

func ReadJsonConfig(filePath string) (*Config, error)

func (*Config) FormatTopic

func (conf *Config) FormatTopic()

func (*Config) Print

func (conf *Config) Print()

func (*Config) Validate

func (conf *Config) Validate() error

type MqttConfig

type MqttConfig struct {
	Host  string `json:"mqtt_host,omitempty"`
	Topic string `json:"mqtt_topic,omitempty"`
}

type SensorConfig

type SensorConfig struct {
	GpioPin               string `json:"gpio_pin,omitempty"`
	GpioPollingIntervalMs int    `json:"gpio_polling_interval_ms,omitempty"`
}

func (*SensorConfig) ConfigFromEnv

func (conf *SensorConfig) ConfigFromEnv()

func (*SensorConfig) Print

func (conf *SensorConfig) Print()

func (*SensorConfig) Validate

func (conf *SensorConfig) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL