config

package
v0.9.3-dev.8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: GPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultLogLevel is the persisted logging level used without an override.
	DefaultLogLevel = "info"
	// DefaultLogMaxSizeMB is the active log rotation limit in MiB used without an override.
	DefaultLogMaxSizeMB int64 = 10
	// DefaultLogMaxFiles is the retained file count used without an override.
	DefaultLogMaxFiles int64 = 3
)

Variables

This section is empty.

Functions

func ApplyCoreChannelSidecar added in v0.5.0

func ApplyCoreChannelSidecar(settings *Settings, sidecarPath string) (bool, error)

ApplyCoreChannelSidecar applies a packaged core-channel sidecar to settings. A missing or invalid sidecar is ignored. An unchanged stamp is a no-op so a later TUI channel switch is not reverted by an old sidecar file.

func AtomicWrite

func AtomicWrite(path string, content []byte, mode os.FileMode) error

func LoadOrCreateWithSidecarOutcome added in v0.9.2

func LoadOrCreateWithSidecarOutcome(path, sidecar string) (settings Settings, created bool, result CommitResult, err error)

LoadOrCreateWithSidecarOutcome loads or creates settings and reports the outcome of any write.

func Save

func Save(path string, settings Settings) error

Types

type CommitResult added in v0.9.2

type CommitResult struct {
	Committed bool
	Warning   error
}

CommitResult describes whether an atomic settings write crossed its replace commit point.

func AtomicWriteWithCommit added in v0.9.2

func AtomicWriteWithCommit(path string, content []byte, mode os.FileMode) (CommitResult, error)

AtomicWriteWithCommit atomically replaces path and reports whether replacement committed.

func SaveWithCommit added in v0.9.2

func SaveWithCommit(path string, settings Settings) (CommitResult, error)

SaveWithCommit validates and canonically persists settings without modifying its argument.

type LoggingSettings added in v0.9.2

type LoggingSettings struct {
	Level     string `yaml:"level"`
	MaxSizeMB int64  `yaml:"max-size-mb"`
	MaxFiles  int64  `yaml:"max-files"`
}

LoggingSettings controls the level and retention limits for Mihari file logs.

func DefaultLoggingSettings added in v0.9.2

func DefaultLoggingSettings() LoggingSettings

DefaultLoggingSettings returns the logging configuration used when no override is persisted.

type Settings

type Settings struct {
	Schema             string           `yaml:"schema"`
	MixedAddr          string           `yaml:"mixed-addr"`
	ControllerAddr     string           `yaml:"controller-addr"`
	WebAddr            string           `yaml:"web-addr"`
	ControllerSecret   string           `yaml:"controller-secret"`
	SystemProxyDesired bool             `yaml:"system-proxy-desired,omitempty"`
	Tun                map[string]any   `yaml:"tun,omitempty"` // managed block; empty = unmanaged
	CoreChannel        string           `yaml:"core-channel,omitempty"`
	CoreChannelBundle  string           `yaml:"core-channel-bundle,omitempty"`
	Logging            *LoggingSettings `yaml:"log,omitempty"`
}

func Defaults

func Defaults() Settings

func Load

func Load(path string) (Settings, error)

func LoadOrCreate

func LoadOrCreate(path string) (Settings, error)

func LoadOrCreateResult

func LoadOrCreateResult(path string) (Settings, bool, error)

LoadOrCreateResult loads settings or creates them and reports whether this call created the file.

func LoadOrCreateWithSidecar added in v0.5.0

func LoadOrCreateWithSidecar(path, sidecar string) (Settings, bool, error)

LoadOrCreateWithSidecar loads settings or creates them, applying a packaged core-channel sidecar. On first create the sidecar is applied before the first Save so the file is never written as a stable-only default and then rewritten.

func (Settings) Clone added in v0.9.2

func (s Settings) Clone() Settings

Clone returns a copy of Settings that does not share mutable YAML values.

func (Settings) EffectiveLogging added in v0.9.2

func (s Settings) EffectiveLogging() LoggingSettings

EffectiveLogging returns logging settings with omitted and zero-valued fields defaulted.

func (*Settings) SetLogging added in v0.9.2

func (s *Settings) SetLogging(logging LoggingSettings)

SetLogging stores a complete non-default logging override or removes the default override.

func (Settings) Validate

func (s Settings) Validate() error

Jump to

Keyboard shortcuts

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