utils

package
v0.251.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadYAML

func LoadYAML[T any](path, label string, defaults func() *T) (*T, error)

LoadYAML reads path to run with: ${VAR} references resolve from the environment before unmarshalling, and a literal `${…}` must be escaped as `$$…`. A missing file yields defaults(). label scopes error messages, e.g. "channels" produces "failed to read channels config: …".

func LoadYAMLAsWritten added in v0.250.0

func LoadYAMLAsWritten[T any](path, label string, defaults func() *T) (*T, error)

LoadYAMLAsWritten reads path to edit: every ${VAR} reference stays as written, so saving the result back never puts a variable's value in its place. A missing file yields defaults().

func SaveYAML

func SaveYAML[T any](path, label string, cfg *T) error

SaveYAML writes cfg to path, creating any missing parent directories. It always emits the YAML document marker `---\n` and uses 2-space indent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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