Documentation
¶
Overview ¶
Package startup holds the logic-bearing startup helpers extracted from the picture-frame command: config transforms and backend selection that are worth testing in isolation from the binary's process-level wiring.
Index ¶
- func ApplyConfiguredLogLevel(levelVar *slog.LevelVar, cfg *config.Config, log *slog.Logger)
- func BuildSensorSpecs(cfg *config.Config) []mqtt.SensorSpec
- func BuildWeatherFetcher(log *slog.Logger, cfg *config.Config, production bool) weather.Fetcher
- func HealthCheck(log *slog.Logger) error
- func MakeRestartFunc(ch chan<- struct{}) func() error
- func NewDisplayController(log *slog.Logger, cfg config.DisplayConfig) (displaypkg.Controller, error)
- func SyncerStatus(s *library.Syncer) library.SyncerStatus
- func WeatherEnabled(cfg *config.Config, production bool) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyConfiguredLogLevel ¶
ApplyConfiguredLogLevel sets the running log level from the LOG_LEVEL env var, falling back to config; an invalid value is warned about and left unchanged. The env var always wins, even over a valid config value.
func BuildSensorSpecs ¶
func BuildSensorSpecs(cfg *config.Config) []mqtt.SensorSpec
BuildSensorSpecs adapts BLE sensors to MQTT specs. Bridging mqtt-subscriber readings would loop them back through the same broker.
func BuildWeatherFetcher ¶
BuildWeatherFetcher returns the OWM client when an API key is set, the static dev mock when weather is configured without a key, or nil to disable weather.
func HealthCheck ¶
HealthCheck serves /healthz and / against a throwaway in-process server (no socket, no hardware), so the updater can run `--health-check` on a freshly-downloaded binary before swapping it, proving it boots, parses config, and renders the UI on this device.
func MakeRestartFunc ¶
func MakeRestartFunc(ch chan<- struct{}) func() error
MakeRestartFunc returns the restart callback for the HTTP layer and updater: it enqueues an in-place re-exec (same PID, so systemd sees no crash), dropping the request if one is already queued. One kind suffices, the kiosk reloads itself on the next SSE version change.
func NewDisplayController ¶
func NewDisplayController(log *slog.Logger, cfg config.DisplayConfig) (displaypkg.Controller, error)
NewDisplayController builds the production controller: wlopm (default) or vcgencmd (legacy fkms).
func SyncerStatus ¶
func SyncerStatus(s *library.Syncer) library.SyncerStatus
SyncerStatus avoids the typed-nil-in-interface trap: returning a nil *library.Syncer straight into the interface field would yield a non-nil interface value, so callers must funnel through this guard.
Types ¶
This section is empty.