config

package
v3.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const NameRegexp = "^[a-zA-Z0-9\\-]{1,32}$"

Variables

This section is empty.

Functions

func TransformAndValidateListUnique

func TransformAndValidateListUnique[I any, O Nameable](
	inp []I,
	transformer func(inp I) (ret O, err []error),
) (ret []O, err []error)

func TransformAndValidateMap

func TransformAndValidateMap[I any, O any](
	inp map[string]I,
	transformer func(inp I, name string) (ret O, err []error),
) (ret map[string]O, err []error)

func TransformAndValidateMapToList

func TransformAndValidateMapToList[I any, O any](
	inp map[string]I,
	transformer func(inp I, name string) (ret O, err []error),
) (ret []O, err []error)

Types

type AuthenticationConfig

type AuthenticationConfig struct {
	// contains filtered or unexported fields
}

func (AuthenticationConfig) Enabled

func (c AuthenticationConfig) Enabled() bool

func (AuthenticationConfig) HtaccessFile

func (c AuthenticationConfig) HtaccessFile() string

func (AuthenticationConfig) JwtSecret

func (c AuthenticationConfig) JwtSecret() []byte

func (AuthenticationConfig) JwtValidityPeriod

func (c AuthenticationConfig) JwtValidityPeriod() time.Duration

type Config

type Config struct {
	// contains filtered or unexported fields
}

func ReadConfig

func ReadConfig(yamlStr []byte, bypassFileCheck bool) (config Config, err []error)

func ReadConfigFile

func ReadConfigFile(exe, source string, bypassFileCheck bool) (config Config, err []error)

func (Config) Authentication

func (c Config) Authentication() AuthenticationConfig

func (Config) Devices

func (c Config) Devices() []DeviceConfig

func (Config) HttpDevices

func (c Config) HttpDevices() []HttpDeviceConfig

func (Config) HttpServer

func (c Config) HttpServer() HttpServerConfig

func (Config) LogCommandStorageDebug

func (c Config) LogCommandStorageDebug() bool

func (Config) LogConfig

func (c Config) LogConfig() bool

func (Config) LogStateStorageDebug

func (c Config) LogStateStorageDebug() bool

func (Config) LogWorkerStart

func (c Config) LogWorkerStart() bool

func (Config) MarshalYAML

func (c Config) MarshalYAML() (interface{}, error)

func (Config) Modbus

func (c Config) Modbus() []ModbusConfig

func (Config) ModbusDevices

func (c Config) ModbusDevices() []ModbusDeviceConfig

func (Config) MqttClients

func (c Config) MqttClients() []MqttClientConfig

func (Config) MqttDevices

func (c Config) MqttDevices() []MqttDeviceConfig

func (Config) PrintConfig

func (c Config) PrintConfig() (err error)

func (Config) ProjectTitle

func (c Config) ProjectTitle() string

func (Config) Version

func (c Config) Version() int

func (Config) VictronDevices

func (c Config) VictronDevices() []VictronDeviceConfig

func (Config) Views

func (c Config) Views() []ViewConfig

type DeviceConfig

type DeviceConfig struct {
	// contains filtered or unexported fields
}

func (DeviceConfig) Filter

func (c DeviceConfig) Filter() FilterConfig

func (DeviceConfig) LogComDebug

func (c DeviceConfig) LogComDebug() bool

func (DeviceConfig) LogDebug

func (c DeviceConfig) LogDebug() bool

func (DeviceConfig) Name

func (c DeviceConfig) Name() string

func (DeviceConfig) RestartInterval

func (c DeviceConfig) RestartInterval() time.Duration

func (DeviceConfig) RestartIntervalMaxBackoff

func (c DeviceConfig) RestartIntervalMaxBackoff() time.Duration

type FilterConfig

type FilterConfig struct {
	// contains filtered or unexported fields
}

func (FilterConfig) DefaultInclude

func (c FilterConfig) DefaultInclude() bool

func (FilterConfig) IncludeCategories

func (c FilterConfig) IncludeCategories() []string

func (FilterConfig) IncludeRegisters

func (c FilterConfig) IncludeRegisters() []string

func (FilterConfig) SkipCategories

func (c FilterConfig) SkipCategories() []string

func (FilterConfig) SkipRegisters

func (c FilterConfig) SkipRegisters() []string

type HttpDeviceConfig

type HttpDeviceConfig struct {
	DeviceConfig
	// contains filtered or unexported fields
}

func (HttpDeviceConfig) Kind

func (HttpDeviceConfig) LogDebug

func (c HttpDeviceConfig) LogDebug() bool

func (HttpDeviceConfig) Password

func (c HttpDeviceConfig) Password() string

func (HttpDeviceConfig) PollInterval

func (c HttpDeviceConfig) PollInterval() time.Duration

func (HttpDeviceConfig) Url

func (c HttpDeviceConfig) Url() *url.URL

func (HttpDeviceConfig) Username

func (c HttpDeviceConfig) Username() string

type HttpServerConfig

type HttpServerConfig struct {
	// contains filtered or unexported fields
}

func (HttpServerConfig) Bind

func (c HttpServerConfig) Bind() string

func (HttpServerConfig) ConfigExpires

func (c HttpServerConfig) ConfigExpires() time.Duration

func (HttpServerConfig) Enabled

func (c HttpServerConfig) Enabled() bool

func (HttpServerConfig) FrontendExpires

func (c HttpServerConfig) FrontendExpires() time.Duration

func (HttpServerConfig) FrontendPath

func (c HttpServerConfig) FrontendPath() string

func (HttpServerConfig) FrontendProxy

func (c HttpServerConfig) FrontendProxy() *url.URL

func (HttpServerConfig) LogDebug

func (c HttpServerConfig) LogDebug() bool

func (HttpServerConfig) LogRequests

func (c HttpServerConfig) LogRequests() bool

func (HttpServerConfig) Port

func (c HttpServerConfig) Port() int

type ModbusConfig

type ModbusConfig struct {
	// contains filtered or unexported fields
}

func (ModbusConfig) BaudRate

func (c ModbusConfig) BaudRate() int

func (ModbusConfig) Device

func (c ModbusConfig) Device() string

func (ModbusConfig) LogDebug

func (c ModbusConfig) LogDebug() bool

func (ModbusConfig) Name

func (c ModbusConfig) Name() string

func (ModbusConfig) ReadTimeout

func (c ModbusConfig) ReadTimeout() time.Duration

type ModbusDeviceConfig

type ModbusDeviceConfig struct {
	DeviceConfig
	// contains filtered or unexported fields
}

func (ModbusDeviceConfig) Address

func (c ModbusDeviceConfig) Address() byte

func (ModbusDeviceConfig) Bus

func (c ModbusDeviceConfig) Bus() string

func (ModbusDeviceConfig) Kind

func (ModbusDeviceConfig) PollInterval

func (c ModbusDeviceConfig) PollInterval() time.Duration

func (ModbusDeviceConfig) RelayClosedLabel

func (c ModbusDeviceConfig) RelayClosedLabel(name string) string

func (ModbusDeviceConfig) RelayDescription

func (c ModbusDeviceConfig) RelayDescription(name string) string

func (ModbusDeviceConfig) RelayOpenLabel

func (c ModbusDeviceConfig) RelayOpenLabel(name string) string

type MqttClientConfig

type MqttClientConfig struct {
	// contains filtered or unexported fields
}

func (MqttClientConfig) AvailabilityClient

func (c MqttClientConfig) AvailabilityClient() MqttSectionConfig

func (MqttClientConfig) AvailabilityClientTopic

func (c MqttClientConfig) AvailabilityClientTopic() string

func (MqttClientConfig) AvailabilityDevice

func (c MqttClientConfig) AvailabilityDevice() MqttSectionConfig

func (MqttClientConfig) AvailabilityDeviceTopic

func (c MqttClientConfig) AvailabilityDeviceTopic(deviceName string) string

func (MqttClientConfig) Broker

func (c MqttClientConfig) Broker() *url.URL

Broker always returns a non-nil pointer.

func (MqttClientConfig) ClientId

func (c MqttClientConfig) ClientId() string

func (MqttClientConfig) Command

func (c MqttClientConfig) Command() MqttSectionConfig

func (MqttClientConfig) CommandTopic

func (c MqttClientConfig) CommandTopic(deviceName, registerName string) string

func (MqttClientConfig) ConnectRetryDelay

func (c MqttClientConfig) ConnectRetryDelay() time.Duration

func (MqttClientConfig) ConnectTimeout

func (c MqttClientConfig) ConnectTimeout() time.Duration

func (MqttClientConfig) HomeassistantDiscovery

func (c MqttClientConfig) HomeassistantDiscovery() MqttSectionConfig

func (MqttClientConfig) HomeassistantDiscoveryTopic

func (c MqttClientConfig) HomeassistantDiscoveryTopic(component, nodeId, objectId string) string

func (MqttClientConfig) KeepAlive

func (c MqttClientConfig) KeepAlive() time.Duration

func (MqttClientConfig) LogDebug

func (c MqttClientConfig) LogDebug() bool

func (MqttClientConfig) LogMessages

func (c MqttClientConfig) LogMessages() bool

func (MqttClientConfig) MaxBacklogSize

func (c MqttClientConfig) MaxBacklogSize() int

func (MqttClientConfig) MqttDevices

func (c MqttClientConfig) MqttDevices() []MqttClientDeviceConfig

func (MqttClientConfig) Name

func (c MqttClientConfig) Name() string

func (MqttClientConfig) Password

func (c MqttClientConfig) Password() string

func (MqttClientConfig) ProtocolVersion

func (c MqttClientConfig) ProtocolVersion() int

func (MqttClientConfig) ReadOnly

func (c MqttClientConfig) ReadOnly() bool

func (MqttClientConfig) Realtime

func (c MqttClientConfig) Realtime() MqttSectionConfig

func (MqttClientConfig) RealtimeTopic

func (c MqttClientConfig) RealtimeTopic(deviceName, registerName string) string

func (MqttClientConfig) Structure

func (c MqttClientConfig) Structure() MqttSectionConfig

func (MqttClientConfig) StructureTopic

func (c MqttClientConfig) StructureTopic(deviceName string) string

func (MqttClientConfig) Telemetry

func (c MqttClientConfig) Telemetry() MqttSectionConfig

func (MqttClientConfig) TelemetryTopic

func (c MqttClientConfig) TelemetryTopic(deviceName string) string

func (MqttClientConfig) TopicPrefix

func (c MqttClientConfig) TopicPrefix() string

func (MqttClientConfig) User

func (c MqttClientConfig) User() string

type MqttClientDeviceConfig

type MqttClientDeviceConfig struct {
	// contains filtered or unexported fields
}

func (MqttClientDeviceConfig) MqttTopics

func (c MqttClientDeviceConfig) MqttTopics() []string

func (MqttClientDeviceConfig) Name

func (c MqttClientDeviceConfig) Name() string

type MqttDeviceConfig

type MqttDeviceConfig struct {
	DeviceConfig
	// contains filtered or unexported fields
}

func (MqttDeviceConfig) Kind

type MqttDeviceSectionConfig

type MqttDeviceSectionConfig struct {
	// contains filtered or unexported fields
}

func (MqttDeviceSectionConfig) Filter

func (MqttDeviceSectionConfig) Name

type MqttSectionConfig

type MqttSectionConfig struct {
	// contains filtered or unexported fields
}

func (MqttSectionConfig) Devices

func (MqttSectionConfig) Enabled

func (c MqttSectionConfig) Enabled() bool

func (MqttSectionConfig) Interval

func (c MqttSectionConfig) Interval() time.Duration

func (MqttSectionConfig) Qos

func (c MqttSectionConfig) Qos() byte

func (MqttSectionConfig) Retain

func (c MqttSectionConfig) Retain() bool

func (MqttSectionConfig) TopicTemplate

func (c MqttSectionConfig) TopicTemplate() string

type Nameable

type Nameable interface {
	Name() string
}

type RelayConfig

type RelayConfig struct {
	// contains filtered or unexported fields
}

type VictronDeviceConfig

type VictronDeviceConfig struct {
	DeviceConfig
	// contains filtered or unexported fields
}

func (VictronDeviceConfig) Device

func (c VictronDeviceConfig) Device() string

func (VictronDeviceConfig) IoLog added in v3.2.0

func (c VictronDeviceConfig) IoLog() string

func (VictronDeviceConfig) Kind

func (VictronDeviceConfig) PollInterval added in v3.2.0

func (c VictronDeviceConfig) PollInterval() time.Duration

type ViewConfig

type ViewConfig struct {
	// contains filtered or unexported fields
}

func (ViewConfig) Autoplay

func (c ViewConfig) Autoplay() bool

func (ViewConfig) Devices

func (c ViewConfig) Devices() []ViewDeviceConfig

func (ViewConfig) Hidden

func (c ViewConfig) Hidden() bool

func (ViewConfig) IsAllowed

func (c ViewConfig) IsAllowed(user string) bool

func (ViewConfig) IsPublic

func (c ViewConfig) IsPublic() bool

func (ViewConfig) Name

func (c ViewConfig) Name() string

func (ViewConfig) Title

func (c ViewConfig) Title() string

type ViewDeviceConfig

type ViewDeviceConfig struct {
	// contains filtered or unexported fields
}

func (ViewDeviceConfig) Filter

func (c ViewDeviceConfig) Filter() FilterConfig

func (ViewDeviceConfig) Name

func (c ViewDeviceConfig) Name() string

func (ViewDeviceConfig) Title

func (c ViewDeviceConfig) Title() string

Jump to

Keyboard shortcuts

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