config

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 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"`
	MetricsAddr   string `json:"metrics_addr,omitempty"`
	IntervalSecs  int    `json:"interval_s,omitempty"`
	StatIntervals []int  `json:"stat_intervals,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) GetStatIntervalMax added in v1.5.0

func (conf *Config) GetStatIntervalMax() (int, error)

func (*Config) GetStatIntervalMin added in v1.5.0

func (conf *Config) GetStatIntervalMin() (int, error)

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"`
	ClientKeyFile  string `json:"mqtt_ssl_key_file,omitempty"`
	ClientCertFile string `json:"mqtt_ssl_cert_file,omitempty"`
	ServerCaFile   string `json:"mqtt_ssl_ca_file,omitempty"`
	StatsTopic     string `json:"mqtt_stats_topic,omitempty"`
}

func (*MqttConfig) Print added in v1.6.0

func (conf *MqttConfig) Print()

func (*MqttConfig) UsesSslCerts added in v1.6.0

func (conf *MqttConfig) UsesSslCerts() bool

func (*MqttConfig) Validate added in v1.6.0

func (conf *MqttConfig) Validate() error

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