Add seconds config
This commit is contained in:
4
db/db.go
4
db/db.go
@@ -200,6 +200,7 @@ type Settings struct {
|
||||
BlinkOffMs int
|
||||
ColorClock string
|
||||
ColorAlarm string
|
||||
ShowSeconds bool
|
||||
}
|
||||
|
||||
func DefaultSettings() Settings {
|
||||
@@ -211,6 +212,7 @@ func DefaultSettings() Settings {
|
||||
BlinkOffMs: 500,
|
||||
ColorClock: "#00FF88",
|
||||
ColorAlarm: "#FF4444",
|
||||
ShowSeconds: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +225,7 @@ func (s *Store) LoadSettings() Settings {
|
||||
cfg.BlinkOffMs = s.getSettingInt("blink_off_ms", cfg.BlinkOffMs)
|
||||
cfg.ColorClock = s.GetSetting("color_clock", cfg.ColorClock)
|
||||
cfg.ColorAlarm = s.GetSetting("color_alarm", cfg.ColorAlarm)
|
||||
cfg.ShowSeconds = s.GetSetting("show_seconds", "true") == "true"
|
||||
return cfg
|
||||
}
|
||||
|
||||
@@ -235,6 +238,7 @@ func (s *Store) SaveSettings(cfg Settings) error {
|
||||
"blink_off_ms": fmt.Sprintf("%d", cfg.BlinkOffMs),
|
||||
"color_clock": cfg.ColorClock,
|
||||
"color_alarm": cfg.ColorAlarm,
|
||||
"show_seconds": fmt.Sprintf("%t", cfg.ShowSeconds),
|
||||
}
|
||||
for k, v := range pairs {
|
||||
if err := s.SetSetting(k, v); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user