updated gitignore and missed files
This commit is contained in:
parent
546f80cfce
commit
bd4694bbff
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
weather
|
/weather
|
||||||
*.ini
|
*.ini
|
||||||
|
39
cmd/weather/weather.go
Normal file
39
cmd/weather/weather.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"git.paulbsd.com/paulbsd/weather/src/config"
|
||||||
|
"git.paulbsd.com/paulbsd/weather/src/data"
|
||||||
|
_ "github.com/influxdata/influxdb1-client"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var c config.Config
|
||||||
|
var cp string
|
||||||
|
var err error
|
||||||
|
|
||||||
|
flag.StringVar(&cp, "configfile", "weather.ini", "config file to use with fuelprices section")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
err = config.GetConfig(&c, cp)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, city := range c.WeatherCities {
|
||||||
|
d, err := data.FetchData(&c, city)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = data.SendDataToInflux(&c, d)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
} else {
|
||||||
|
log.Println(fmt.Sprintf("Successfully sent data for %s", city))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user