add web ui

This commit is contained in:
2026-01-27 16:51:58 +11:00
parent 7526a7af93
commit 57a3a29914
12 changed files with 1158 additions and 23 deletions

View File

@@ -39,6 +39,11 @@ type Config struct {
} `yaml:"open_meteo"`
} `yaml:"pollers"`
Web struct {
Enabled *bool `yaml:"enabled"`
Listen string `yaml:"listen"`
} `yaml:"web"`
Wunderground struct {
Enabled bool `yaml:"enabled"`
StationID string `yaml:"station_id"`
@@ -77,6 +82,13 @@ func Load(path string) (*Config, error) {
if c.Wunderground.Interval == 0 {
c.Wunderground.Interval = 60 * time.Second
}
if c.Web.Listen == "" {
c.Web.Listen = ":8080"
}
if c.Web.Enabled == nil {
enabled := true
c.Web.Enabled = &enabled
}
// If enabled, require creds
if c.Wunderground.Enabled && (c.Wunderground.StationID == "" || c.Wunderground.StationKey == "") {
return nil, errors.New("wunderground enabled but station_id/station_key not set")