add web ui
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user