You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
587 B
27 lines
587 B
package main |
|
|
|
import ( |
|
"git.darknebu.la/akarl/tankerkoenig2influx/api" |
|
"git.darknebu.la/akarl/tankerkoenig2influx/struct" |
|
"github.com/jasonlvhit/gocron" |
|
"github.com/spf13/viper" |
|
"log" |
|
) |
|
|
|
func main() { |
|
|
|
viper.SetConfigName("config") |
|
viper.AddConfigPath(".") |
|
var configuration structure.Configuration |
|
|
|
if err := viper.ReadInConfig(); err != nil { |
|
log.Fatalf("Error reading config file, %s", err) |
|
} |
|
err := viper.Unmarshal(&configuration) |
|
if err != nil { |
|
log.Fatalf("unable to decode into struct, %v", err) |
|
} |
|
|
|
gocron.Every(1).Minute().Do(api.GetPrices) |
|
<-gocron.Start() |
|
}
|
|
|