Add enable switch for weather to config

This commit is contained in:
Elara 2022-02-22 08:33:27 -08:00
parent 4bdb82b1bc
commit c08ddfd810
2 changed files with 5 additions and 0 deletions

View File

@ -27,4 +27,5 @@
vol.interval = 5
[weather]
enabled = true
location = "Los Angeles, CA"

View File

@ -61,6 +61,10 @@ type OSMData []struct {
var sendWeatherCh = make(chan struct{}, 1)
func initWeather(dev *infinitime.Device) error {
if !k.Bool("weather.enabled") {
return nil
}
// Get location based on string in config
lat, lon, err := getLocation(k.String("weather.location"))
if err != nil {