config

package
v0.0.0-...-46c35f9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(path string, onReload ...func(*koanf.Koanf)) (*koanf.Koanf, error)

Loads a YAML configuration file from the given path and overrides it with environment variables. If the file cannot be loaded or parsed as YAML, an error is returned. Requires a default config of any kind, will try to serialize the configuration to outConfig if present (needs to be a pointer to a struct).

func Save

func Save(text string) error

Save the given text in the configuration file on disk.

func Text

func Text() string

Returns full configuration file contents.

Types

type Collector

type Collector struct {
	Port int `yaml:"port"`
}

type Location

type Location struct {
	Name      string  `yaml:"name"`
	Elevation float64 `yaml:"elevation"`
	Latitude  float64 `yaml:"latitude"`
	Longitude float64 `yaml:"longitude"`
}

type NATS

type NATS struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type Node

type Node struct {
	Port int `yaml:"port"`
}

type NodeConfig

type NodeConfig struct {
	Collector `yaml:"collector"`
	Location  `yaml:"location"`
	Node      `yaml:"node"`
	NATS      `yaml:"nats"`
}

Jump to

Keyboard shortcuts

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