config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: BSD-3-Clause 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 {
	Log           Log            `toml:"log"`
	Notifications []Notification `toml:"notification"`
	Nameservers   []Nameserver   `toml:"nameserver"`
	Domains       []Domain       `toml:"domain"`
}

func Parse

func Parse(filename string) (Config, error)

type Domain

type Domain struct {
	// Name is the domain name including its zone (eg. "raspberry-pi.example.com").
	Name EnvString `toml:"name"`
	// Zone is the zone name matching a configured nameserver.
	Zone EnvString `toml:"zone"`
	// Kind is the dns record type (eg. "AAAA" for IPv6 or "A" for IPv4).
	Kind EnvString `toml:"kind"`
	// Interface is an optional filter for the network interface (eg. wlan0 or eth0).
	Interface EnvString `toml:"interface"`
	// Suffix is an optional filter for the part after the network mask
	// (eg. the remaining 64 bits of a ::/64 address).
	Suffix EnvString `toml:"suffix"`
}

type EnvString

type EnvString string

EnvString is a string that may contain environmental variables `${env}` or `$env`.

func (EnvString) String

func (e EnvString) String() string

String implements fmt.Stringer.

func (*EnvString) UnmarshalText

func (e *EnvString) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Log

type Log struct {
	// Level is the log level (eg. "debug", "info", "warn" or "error").
	Level EnvString `toml:"level"`
	// Format is the log output format.
	// "json" emits machine readable json objects, "text" emits human readable text.
	Format EnvString `toml:"format"`
	// Caller is a flag to enable source filenames and line numbers in the log output.
	Caller bool `toml:"caller"`
}

type Nameserver

type Nameserver struct {
	// Provider is the name of the api adapter used to change dns records.
	Provider EnvString `toml:"provider"`
	// Credentials is a provider dependant secret string (eg. a Cloudflare API Token).
	Credentials EnvString `toml:"credentials"`
	// Zones is a slice of zones this nameserver is responsible for (eg. "example.com").
	Zones []EnvString `toml:"zones"`
}

type Notification

type Notification struct {
	// Shoutrrr URL (see <https://github.com/containrrr/shoutrrr>)
	URL EnvString `toml:"url"`
}

Jump to

Keyboard shortcuts

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