adding default TheSettings object, changing error logging behavior

This commit is contained in:
William Dillon 2025-12-30 22:00:27 -05:00
parent 2ce9bf7eff
commit 4c88a05b82

View File

@ -18,6 +18,8 @@ import (
var ( var (
MaintenanceRoutinePace = time.Second MaintenanceRoutinePace = time.Second
WarnIfFileNotFound = false WarnIfFileNotFound = false
TheSettings = NewSettings("settings.conf", true)
) )
type Settings struct { type Settings struct {
@ -155,7 +157,7 @@ func NewSettingsWithContext(ctx context.Context, filename string, logUpdates boo
filename: strings.Clone(filename), filename: strings.Clone(filename),
} }
settings.LogUpdates.Store(logUpdates) settings.LogUpdates.Store(logUpdates)
if err := settings.lockedUpdate(); err != nil { if err := settings.lockedUpdate(); err != nil && (!errors.Is(err, os.ErrNotExist) || WarnIfFileNotFound) {
log.Printf("NewSettingsWithContext %s error from initial update: %v\n", filepath.Base(filename), err) log.Printf("NewSettingsWithContext %s error from initial update: %v\n", filepath.Base(filename), err)
} }
go settings.maintenanceRoutine(ctx) go settings.maintenanceRoutine(ctx)