Documentation
¶
Overview ¶
Package config provides configuration management backed by SQLite.
The Manager reads and writes UI preferences (colours, locale, display config) using the shared store.DB. On first run it imports any existing config.yaml so users upgrading from a YAML-based installation don't lose their settings.
Index ¶
Constants ¶
const ( DefaultBackgroundColor = "#000000" DefaultBackgroundImage = "background.png" DefaultTextColor = "#FFFFFF" DefaultFontFamily = "GoRegular" DefaultFontSize = 11.0 DefaultTimeFontSize = 14.0 DefaultLayout = "dashboard" DefaultDateFormat = "MM/DD/YYYY" )
Default configuration values.
Variables ¶
var (
ErrInvalidColor = errors.New("invalid color: must be hex color (e.g. #FFFFFF)")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// openapi:description Background color in hex format
// openapi:example #000000
BackgroundColor string `mapstructure:"background_color" json:"background_color"`
// openapi:description Background image filename
// openapi:example background.png
BackgroundImage string `mapstructure:"background_image" json:"background_image"`
// openapi:description Text color in hex format
// openapi:example #FFFFFF
TextColor string `mapstructure:"text_color" json:"text_color"`
// openapi:description List of custom image paths
ImagePaths []string `mapstructure:"image_paths" json:"image_paths"`
// openapi:description Display-specific configuration
Display DisplayConfig `mapstructure:"display" json:"display"`
}
Config holds the application configuration (UI settings only). Module-specific configs are managed per-zone via zone config system. openapi:schema Config
func (*Config) GetBackgroundColor ¶
GetBackgroundColor parses and returns the background color.
func (*Config) GetTextColor ¶
GetTextColor parses and returns the text color.
type DisplayConfig ¶
type DisplayConfig struct {
// openapi:description Font family name
// openapi:example GoRegular
FontFamily string `mapstructure:"font_family" json:"font_family"`
// openapi:description Base font size in points
// openapi:example 11.0
FontSize float64 `mapstructure:"font_size" json:"font_size"`
// openapi:description Time display font size in points
// openapi:example 14.0
TimeFontSize float64 `mapstructure:"time_font_size" json:"time_font_size"`
// openapi:description Layout style
// openapi:enum dashboard minimalist compact balanced
// openapi:example dashboard
Layout string `mapstructure:"layout" json:"layout"`
// openapi:description Date format string
// openapi:example MM/DD/YYYY
DateFormat string `mapstructure:"date_format" json:"date_format"`
}
DisplayConfig holds display-specific configuration. openapi:schema DisplayConfig
type Manager ¶
type Manager struct {
IsFirstRun bool // true when the DB was freshly created on this launch
// contains filtered or unexported fields
}
Manager handles configuration loading, validation, and watching. The zero value is invalid — use NewManager.
func NewManager ¶
NewManager creates a Manager backed by the given store. It loads the current config from the store (applying defaults for any missing keys) and marks IsFirstRun if the store was newly created.
func NewManagerFromPath ¶
NewManagerFromPath is a convenience constructor that opens its own store at the given path (or the default path when empty). Callers that already have a *store.DB should use NewManager instead.
func (*Manager) ImportFromYAML ¶
ImportFromYAML imports settings from a legacy config.yaml file into the store. Called once on first run. Silently succeeds if the YAML file doesn't exist (fresh install, not an upgrade).