Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWrite ¶
AtomicWrite writes data to path by temp file + rename, keeping path.bak.
Types ¶
type Config ¶
type Config struct {
DefOrder map[section][]section `yaml:"def_order"`
Defs map[section]Defs `yaml:"defs"`
Prefix string `yaml:"envvar_prefix"`
Order []section `yaml:"order"`
Sections map[section]*Header `yaml:"sections"`
}
func (*Config) ExampleTOML ¶
ExampleTOML renders the commented example configuration (go generate / first-run).
func (*Config) ParamNames ¶
ParamNames is the set of every schema parameter name across sections.
func (*Config) RenderTOML ¶
func (c *Config) RenderTOML(live any, opts RenderOpts) string
RenderTOML renders a configuration file from definitions.yml. A nil live value always produces example output.
type FieldHelp ¶
type FieldHelp struct {
Short string `json:"short,omitempty"`
UIShort string `json:"uishort,omitempty"`
Desc string `json:"desc,omitempty"`
Env string `json:"env,omitempty"`
}
FieldHelp is the English short/desc text from definitions.yml, keyed for the UI.
type Header ¶
type Header struct {
Tail string `yaml:"tail"`
Title string `yaml:"title"`
Text string `yaml:"text"`
Docs string `yaml:"docs"`
Notes string `yaml:"notes"`
Prefix string `yaml:"envvar_prefix"`
Params []*Param `yaml:"params"`
Kind string `yaml:"kind"` // "", list, named
NoHeader bool `yaml:"no_header"` // Do not print [section] header.
}
type Param ¶
type Param struct {
Name string `yaml:"name"`
EnvVar string `yaml:"envvar"`
Default any `yaml:"default"`
Docker any `yaml:"docker"`
Example any `yaml:"example"`
Short string `yaml:"short"`
UIShort string `yaml:"uishort"`
Desc string `yaml:"desc"`
Kind string `yaml:"kind"` // "", list, conlist, map, tables
Recommend []Option `yaml:"recommend"`
Apps []string `yaml:"apps"` // If set, param only appears for these starr app names (e.g. lidarr).
OmitCompose bool `yaml:"omit_compose"`
}
type RenderMode ¶
type RenderMode int
RenderMode selects example (generate/first-run) vs live (save) TOML output.
const ( // RenderExample writes YAML defaults and commented list templates. RenderExample RenderMode = iota // RenderLive writes live struct values and comments keys still at YAML default. RenderLive )
type RenderOpts ¶
type RenderOpts struct {
Mode RenderMode
// Persist is a list of param names (`listen_addr`) or `section.param`
// (`webserver.listen_addr`) that are always written live, even at default.
Persist []string
}
RenderOpts controls TOML rendering.