aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 5f05b96..0c8b430 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -44,6 +44,12 @@ type DisplayConfig struct {
Timezone string `yaml:"timezone"`
// Scale adjusts the overall UI scale (default: 1.0, range: 0.5-2.0)
Scale float64 `yaml:"scale"`
+ // RefreshMode controls how the page updates:
+ // "page" - Full page refresh via meta refresh (default)
+ // "api" - Fetch updates via API without page reload
+ RefreshMode string `yaml:"refresh_mode"`
+ // RefreshInterval is how often to refresh in seconds (default: 30)
+ RefreshInterval int `yaml:"refresh_interval"`
}
// SiteConfig contains site metadata
@@ -252,6 +258,12 @@ func (c *Config) applyDefaults() {
} else if c.Display.Scale > 2.0 {
c.Display.Scale = 2.0
}
+ if c.Display.RefreshMode == "" {
+ c.Display.RefreshMode = "page"
+ }
+ if c.Display.RefreshInterval == 0 {
+ c.Display.RefreshInterval = 30
+ }
// Apply API defaults
if c.API.Access == "" {
@@ -485,6 +497,18 @@ func (c *Config) validate() error {
return fmt.Errorf("api.access is 'authenticated' but no api.keys provided")
}
+ // Validate refresh mode
+ switch c.Display.RefreshMode {
+ case "page", "api":
+ // Valid modes
+ default:
+ return fmt.Errorf("invalid display.refresh_mode %q (must be page or api)", c.Display.RefreshMode)
+ }
+
+ if c.Display.RefreshInterval < 5 {
+ return fmt.Errorf("display.refresh_interval must be at least 5 seconds, got %d", c.Display.RefreshInterval)
+ }
+
return nil
}