Documentation
¶
Overview ¶
Package config assembles the settings a Wegweiser process starts with.
It holds bootstrap settings and nothing else: listen addresses, where the database is, and how loudly to log. Everything an operator manages (zones, records, tokens, the reverse conflict policy) lives in the database and is reachable through the API, because architecture invariant 1 says no feature exists in only one client, and a setting that lives only in a file is a feature that exists only for whoever can log in to the machine (docs/decisions.md D11).
Index ¶
Constants ¶
const DefaultPath = "/etc/wegweiser/config.yaml"
DefaultPath is where the file lives when nothing says otherwise. It matches the packaging: the unit and the container both put it there.
const PathEnv = "WEG_CONFIG"
PathEnv names the environment variable that moves the file.
Variables ¶
var Defaults = struct { DNSListen string APIListen string APIUI bool Database string UDPResponseSize uint16 MaxTCPClients int LogLevel string }{ DNSListen: ":53", APIListen: "127.0.0.1:8053", APIUI: true, Database: "wegweiser.db", UDPResponseSize: 1232, MaxTCPClients: 0, LogLevel: "info", }
Defaults are what a process runs with when nothing says otherwise.
var LogLevels = []string{"debug", "info", "warn", "error"}
LogLevels are the levels Config.LogLevel accepts.
Functions ¶
func LocalAPIAddress ¶
LocalAPIAddress is where the API on this machine listens, as far as the configuration file says, and whether the file said anything.
Types ¶
type Config ¶
type Config struct {
// Path is the file that was read, empty when there was none.
Path string
DNSListen Value[string]
APIListen Value[string]
APIUI Value[bool]
Database Value[string]
UDPResponseSize Value[uint16]
MaxTCPClients Value[int]
LogLevel Value[string]
}
Config is the settings a process starts with.
type DNSFile ¶
type DNSFile struct {
Listen *string `json:"listen,omitempty"`
UDPResponseSize *uint16 `json:"udpResponseSize,omitempty"`
MaxTCPClients *int `json:"maxTCPClients,omitempty"`
}
DNSFile is what the query path takes.
type DatabaseFile ¶
type DatabaseFile struct {
Path *string `json:"path,omitempty"`
}
DatabaseFile is where the store lives.
type File ¶
type File struct {
DNS DNSFile `json:"dns,omitempty"`
API APIFile `json:"api,omitempty"`
Database DatabaseFile `json:"database,omitempty"`
Log LogFile `json:"log,omitempty"`
}
File is the document on disk.
type Flags ¶
type Flags struct {
DNSListen *string
APIListen *string
APIUI *bool
Database *string
UDPResponseSize *uint16
MaxTCPClients *int
LogLevel *string
}
Flags are the settings a command line supplied. A nil field is one the command line did not mention.
type LogFile ¶
type LogFile struct {
Level *string `json:"level,omitempty"`
}
LogFile is how loudly to report.