updated config format for arrays, replaced "," by "|"
This commit is contained in:
parent
bd4694bbff
commit
eddbf0bc90
@ -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
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user