updated config format for arrays, replaced "," by "|"

This commit is contained in:
Paul 2020-02-16 11:25:55 +01:00
parent bd4694bbff
commit eddbf0bc90
3 changed files with 6 additions and 6 deletions

View File

@ -23,8 +23,8 @@ database=database
[weather]
appid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cities=Caen,Paris,Saint-Lo
measurements=temp,humidity,pressure
cities=Caen|Paris|Saint-Lo
measurements=temp|humidity|pressure
```
### Run

View File

@ -20,11 +20,11 @@ func GetConfig(config *Config, configfile string) error {
weatherSection := cfg.Section("weather")
config.WeatherAppID = weatherSection.Key("appid").MustString("appid")
config.WeatherCities = weatherSection.Key("cities").Strings(",")
config.WeatherCities = weatherSection.Key("cities").Strings("|")
if len(config.WeatherCities) < 1 {
return fmt.Errorf("No cities provided in config")
}
config.WeatherMeasurements = weatherSection.Key("measurements").Strings(",")
config.WeatherMeasurements = weatherSection.Key("measurements").Strings("|")
if len(config.WeatherMeasurements) < 1 {
return fmt.Errorf("No measurements provided in config")
}

View File

@ -6,5 +6,5 @@ database=database
[weather]
appid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cities=Caen,Paris,Saint-Lo
measurements=temp,humidity,pressure
cities=Caen|Paris|Saint-Lo
measurements=temp|humidity|pressure