sotatoml

package
v0.0.0-...-87efd8b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: BSD-3-Clause Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEF_CONFIG_ORDER = []string{
	"/usr/lib/sota/conf.d",
	"/var/sota/sota.toml",
	"/etc/sota/conf.d/",
}
View Source
var ErrNoWritableFound = errors.New("no writable TOML file found")

Functions

func IdToBytes

func IdToBytes(id string) []byte

sota.toml has slot id's as "01". We need to turn that into []byte{1}

func SafeWrite

func SafeWrite(name string, data []byte) error

Do an atomic write to the file which prevents race conditions for a reader. Don't worry about writer synchronization as there is only one writer to these files.

Types

type AppConfig

type AppConfig struct {
	// contains filtered or unexported fields
}

func (AppConfig) CombinedConfig

func (c AppConfig) CombinedConfig() (*toml.Tree, error)

func (AppConfig) Get

func (c AppConfig) Get(key string) string

func (AppConfig) GetDefault

func (c AppConfig) GetDefault(key string, defval string) string

func (AppConfig) GetOrDie

func (c AppConfig) GetOrDie(key string) string

func (AppConfig) Has

func (c AppConfig) Has(key string) bool

func (AppConfig) SearchPaths

func (c AppConfig) SearchPaths() []string

SearchPaths returns the list of config paths used to build this AppConfig

func (AppConfig) UpdateKeys

func (c AppConfig) UpdateKeys(keyVals map[string]string) error

Jump to

Keyboard shortcuts

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