0.1.52 Gateway
This commit is contained in:
@@ -50,7 +50,11 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
logLevel := logging.ParseLevel(os.Getenv("MEMBY_LOG_LEVEL"))
|
||||
// A variable rather than a fixed level: the console can move it at runtime, which is
|
||||
// the only way turning debug on is any use — a restart to watch something happen
|
||||
// restarts the thing being watched.
|
||||
logLevel := &slog.LevelVar{}
|
||||
logLevel.Set(logging.ParseLevel(os.Getenv("MEMBY_LOG_LEVEL")))
|
||||
logCapacity := logging.ParseCapacity(os.Getenv("MEMBY_LOG_BUFFER_CAPACITY"), 5_000)
|
||||
logFormat := logging.ParseFormat(os.Getenv("MEMBY_LOG_FORMAT"))
|
||||
logHistoryPath := strings.TrimSpace(os.Getenv("MEMBY_LOG_HISTORY_PATH"))
|
||||
@@ -70,13 +74,13 @@ func main() {
|
||||
// this" is a real question that a reader should never have to scroll for.
|
||||
log = log.With("version", buildinfo.Version())
|
||||
|
||||
if err := run(log, events); err != nil {
|
||||
if err := run(log, events, logLevel); err != nil {
|
||||
log.Error("fatal", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
func run(log *slog.Logger, events *logging.Buffer, logLevel *slog.LevelVar) error {
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -267,6 +271,7 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
AdminEvents: adminBus,
|
||||
Scheduler: sched,
|
||||
Integrations: dispatcher,
|
||||
LogLevel: logLevel,
|
||||
})
|
||||
if err := server.LoadQuietTime(ctx); err != nil {
|
||||
return err
|
||||
@@ -301,10 +306,16 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
if err := server.LoadMaintenance(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
// The operator's runtime amendments to what this container was started with. Loaded
|
||||
// before the watchers below, because two of them read it on their first tick.
|
||||
if err := server.LoadGatewaySettings(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
go server.WatchGatewaySettings(ctx, 30*time.Second)
|
||||
go server.WatchMaintenance(ctx, 30*time.Second)
|
||||
go server.WatchQuietTime(ctx, 30*time.Second)
|
||||
// One probe per gateway, not per TV: the answer is the same for the whole house.
|
||||
go server.WatchEmbyReachability(ctx, cfg.EmbyHealthInterval)
|
||||
go server.WatchEmbyReachability(ctx)
|
||||
// One Sonarr catalogue reading per day records lifecycle changes for the household and
|
||||
// materialises cancellation notifications for every known viewer.
|
||||
go server.WatchSonarrLifecycle(ctx, 24*time.Hour)
|
||||
|
||||
Reference in New Issue
Block a user