config

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Service Service   `yaml:"service" json:"service"`
	Mqtt    Mqtt      `yaml:"mqtt" json:"mqtt"`
	Devices []Devices `yaml:"devices" json:"devices"`
}

func NewConfig

func NewConfig(logger *slog.Logger) (*Config, error)

NewConfig returns app config.

type Devices

type Devices struct {
	Ip   string `env-required:"true" yaml:"ip" json:"ip"`
	Mac  string `env-required:"true" yaml:"mac" json:"mac"`
	Name string `env-required:"true" yaml:"name" json:"name"`
	Port uint16 `env-required:"true" yaml:"port" json:"port"`
	// TemperatureUnit defines the temperature unit of the device, C or F.
	// If this is not set, the temperature unit is Celsius.
	TemperatureUnit string `env-default:"C" yaml:"temperature_unit" json:"temperature_unit"` // BUG cleanenv env-default is not working
}

type Mqtt

type Mqtt struct {
	Broker                   string  `env-required:"true" yaml:"broker" json:"broker"`
	User                     *string `yaml:"user" json:"user"`
	Password                 *string `yaml:"password" json:"password"`
	ClientId                 string  `env-default:"broadlinkac" yaml:"client_id" json:"client_id"`
	TopicPrefix              string  `env-default:"airac" yaml:"topic_prefix" json:"topic_prefix"`
	AutoDiscoveryTopic       *string `yaml:"auto_discovery_topic" json:"auto_discovery_topic"`
	AutoDiscoveryTopicRetain bool    `env-default:"true" yaml:"auto_discovery_topic_retain" json:"auto_discovery_topic_retain"`
	CertificateAuthority     *string `yaml:"certificate_authority" json:"certificate_authority"`
	SkipCertCnCheck          bool    `env-default:"true" yaml:"skip_cert_cn_check" json:"skip_cert_cn_check"`
	CertificateClient        *string `yaml:"certificate_client" json:"certificate_client"`
	KeyClient                *string `yaml:"key-client" json:"key_client"`
}

type Service

type Service struct {
	UpdateInterval int    `env-default:"10"    yaml:"update_interval" json:"update_interval"`
	LogLevel       string `env-default:"error" yaml:"log_level" json:"log_level"`
}

Jump to

Keyboard shortcuts

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