config

package
v0.0.0-...-5635ba1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigFileRead                 = errors.New("config file read error")
	ErrConfigUnmarshal                = errors.New("config unmarshal error")
	ErrDevicePortIsEmpty              = errors.New("device Port is empty")
	ErrDeviceSlaveIdIsWrong           = errors.New("device SlaveId is wrong")
	ErrDeviceNameIsEmpty              = errors.New("device Name is empty")
	ErrDeviceUpdateIntervalIsNegative = errors.New("device UpdateInterval is negative")
	ErrHTTPServerKeyOrCertIsEmpty     = errors.New("HTTP server Key or Certificate is empty")
	ErrHTTPAddressFormat              = errors.New("HTTP server Address should be 'address:port'")
	ErrMQTTAddressFormat              = errors.New("MQTT server Address should be 'scheme://address:port', scheme can be 'tcp', 'ssl' or 'ws'")
)

Functions

func Validate

func Validate(cnf *Config) error

Types

type Config

type Config struct {
	Device struct {
		Port           string
		Name           string
		Model          string
		UpdateInterval int
		SlaveId        int
	}

	HTTP struct {
		Address     string
		Certificate string
		Key         string
	}

	MQTT struct {
		Address       string
		User          string
		Password      string
		Topic         string
		HomeAssistant bool
	}
}

func New

func New(filename string) (*Config, error)

Jump to

Keyboard shortcuts

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