0.1.52 Gateway

This commit is contained in:
ponzischeme89
2026-08-17 19:09:17 +12:00
parent d5a8d3ad88
commit 1da91e40a1
46 changed files with 1626 additions and 106 deletions
+25 -1
View File
@@ -99,7 +99,14 @@ type Server struct {
recommendationBuilds recommendationBuilds
maintenance maintenanceState
quietTime quietTimeState
updatePolicy updatePolicyCache
// gatewaySettings is the operator's runtime amendment to what the container was
// started with. deployedLogLevel is remembered beside the live level variable
// because clearing an override has to restore something, and the level variable
// itself has by then been moved.
gatewaySettings gatewaySettingsState
logLevel *slog.LevelVar
deployedLogLevel slog.Level
updatePolicy updatePolicyCache
// embyHealth is the reachability probe's live finding, which /v1/status publishes so
// a TV can show why playback stopped even if it missed the announcement.
embyHealth embyHealth
@@ -129,6 +136,10 @@ type Deps struct {
AdminEvents *adminevents.Bus
Scheduler *scheduler.Scheduler
Integrations *integrations.Dispatcher
// LogLevel is the live level of the process's own logger, so the console can turn
// debug on and watch the thing it turned it on for. Nil is allowed and means the
// level is fixed at whatever the container was started with.
LogLevel *slog.LevelVar
}
func New(cfg config.Config, deps Deps) *Server {
@@ -152,9 +163,19 @@ func New(cfg config.Config, deps Deps) *Server {
adminEvents: deps.AdminEvents,
scheduler: deps.Scheduler,
integrations: deps.Integrations,
logLevel: deps.LogLevel,
deployedLogLevel: deployedLevel(deps.LogLevel),
}
}
func deployedLevel(level *slog.LevelVar) slog.Level {
if level == nil {
return slog.LevelInfo
}
return level.Level()
}
// publishAdmin reports something an operator would want to know about.
//
// Every caller treats it as fire-and-forget, which is why it returns nothing: the feed is
@@ -409,6 +430,9 @@ func (s *Server) captureClientIdentity(r *http.Request, sess store.Session) stor
s.log.Warn("device version record failed",
"device_id", sess.DeviceID, "error", err)
}
// And it is the only place an operator would otherwise learn that an update
// they offered was actually taken.
s.announceDeviceUpdate(r.Context(), sess, previousVersion)
}
}
return sess