adding default TheSettings object, changing error logging behavior
This commit is contained in:
parent
2ce9bf7eff
commit
4c88a05b82
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user