startup

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyConfiguredLogLevel

func ApplyConfiguredLogLevel(levelVar *slog.LevelVar, cfg *config.Config, log *slog.Logger)

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

func BuildWeatherFetcher(log *slog.Logger, cfg *config.Config, production bool) weather.Fetcher

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

func HealthCheck(log *slog.Logger) error

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.

func WeatherEnabled

func WeatherEnabled(cfg *config.Config, production bool) bool

WeatherEnabled reports whether a weather fetcher runs: real OWM when an api_key is set, or the dev mock when weather is otherwise configured (a location is set).

Types

This section is empty.

Jump to

Keyboard shortcuts

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