settings

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package settings reads the fleet's dynamic-config files (base/ and overrides.yaml), checks them against the settings catalog, and merges them per role.

Index

Constants

View Source
const StopTimeout = 90 * time.Second

StopTimeout is how long systemd waits for a role to stop before it kills it (TimeoutStopSec in temporal@.service).

Variables

This section is empty.

Functions

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration reads a duration the way Temporal does (timestamp.ParseDurationDefaultSeconds): Go's syntax, plus d for 24 hours, and a number without a unit is seconds.

func Readers

func Readers(s catalog.Setting) []string

Readers are the roles that read s, in spec.Roles order: shared means every role.

Types

type Entry

type Entry struct {
	Key    string // the catalog's spelling
	File   string
	Line   int
	Values []Value
}

Entry is one key of one file: the values written for it, and where.

type File

type File map[string]Entry

File is one dynamic-config file: its entries by the catalog's spelling of each key.

func Parse

func Parse(file string, data []byte, c *catalog.Catalog) (File, []spec.Problem, error)

Parse reads the dynamic-config file named file. YAML that does not parse is an error; every other problem is returned, and a key with a problem is left out of the File.

type Layers

type Layers struct {
	Common    File            // base/common.yaml
	Roles     map[string]File // base/<role>.yaml, by role
	Overrides File            // environments/<env>/overrides.yaml
}

Layers are the files that set the dynamic config of an environment's roles, in merge order: later wins, a whole key at a time (TD "Dynamic-config merge order").

func (Layers) Check

func (l Layers) Check(c *catalog.Catalog) (errs, warnings []spec.Problem)

Check returns the errors and the warnings of the layers: a key in a role's file that the role does not read, a key in both common.yaml and a role's file, and a role that would not stop before systemd kills it.

func (Layers) Merge

func (l Layers) Merge(role string, c *catalog.Catalog) File

Merge is the dynamic config of role: each key role reads, from the last layer that sets it. A key's list is replaced, never merged: merging constraint lists would make values nobody wrote.

func (Layers) Trace

func (l Layers) Trace(s catalog.Setting, c *catalog.Catalog) Trace

Trace is where s gets its value, for every role that reads it.

type Source

type Source struct {
	File   string  `json:"file"`
	Values []Value `json:"values"`
}

Source is the list a role runs and the file it comes from, "default" when no file sets it.

type Trace

type Trace struct {
	Default   any                `json:"default"`
	Common    []Value            `json:"common,omitempty"`
	Roles     map[string][]Value `json:"roles,omitempty"`
	Override  []Value            `json:"override,omitempty"`
	Effective map[string]Source  `json:"effective"`
}

Trace is where a setting gets its value in an environment (backend schema Knobs layers): the catalog default, the list each file sets, and what each role that reads it runs. A role file is in Roles only when it sets the key.

type Value

type Value struct {
	Value       any            `yaml:"value" json:"value"`
	Constraints map[string]any `yaml:"constraints,omitempty" json:"constraints,omitempty"`
}

Value is one item of a key's list: the value, and the constraints it applies under (none for the fallback).

Jump to

Keyboard shortcuts

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