cfg

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHeaders

func ConvertHeaders(headers []string, header *http.Header)

ConvertHeaders takes a list of `key=value` headers and adds those trimmed to the specified header struct. It ignores any malformed entries.

Types

type Configuration

type Configuration struct {
	Log      LogConfig  `koanf:"log"`
	Symo     SymoConfig `koanf:"symo"`
	BindAddr string     `koanf:"bind-addr"`
}

Configuration holds a strongly-typed tree of the configuration

func NewDefaultConfig

func NewDefaultConfig() *Configuration

NewDefaultConfig retrieves the hardcoded configs with sane defaults

func ParseConfig

func ParseConfig(version, commit, date string, fs *flag.FlagSet, args []string) *Configuration

ParseConfig overrides internal config defaults with up CLI flags, environment variables and ensures basic validation.

type LogConfig

type LogConfig struct {
	Level   string `koanf:"level"`
	Verbose bool   `koanf:"verbose"`
}

LogConfig configures the logging options

type SymoConfig

type SymoConfig struct {
	URL              string        `koanf:"url"`
	Timeout          time.Duration `koanf:"timeout"`
	Headers          []string      `koanf:"header"`
	PowerFlowEnabled bool          `koanf:"enable-power-flow"`
	ArchiveEnabled   bool          `koanf:"enable-archive"`
}

SymoConfig configures the Fronius Symo device

Jump to

Keyboard shortcuts

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