feat(ticker): Add ticker to env
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0825774d36
commit
437a9eb42f
@ -24,16 +24,16 @@ func Init(alertChan chan api.Availability) {
|
|||||||
log.Fatalf("Fail to instantiate the HTTP Client. Error: %s", err.Error())
|
log.Fatalf("Fail to instantiate the HTTP Client. Error: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
priceAlertStr := os.Getenv("PRICE_ALERT")
|
tickerInSecond := os.Getenv("TICKER_ALERT")
|
||||||
if priceAlertStr != "" {
|
if tickerInSecond != "" {
|
||||||
PriceAlert, err = strconv.ParseInt(priceAlertStr, 10, 64)
|
ticker, err = strconv.ParseInt(tickerInSecond, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("invalid configuration. PRICE_ALERT environement variable should be an integer.")
|
log.Fatalf("invalid configuration. TICKER_ALERT environement variable should be an integer.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// define an interval and the ticker for this interval
|
// define an interval and the ticker for this interval
|
||||||
interval := time.Duration(6) * time.Second
|
interval := time.Duration(ticker) * time.Second
|
||||||
// create a new Ticker
|
// create a new Ticker
|
||||||
tk := time.NewTicker(interval)
|
tk := time.NewTicker(interval)
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
// PriceAlert contain the minimum price that will trigger an alert.
|
// PriceAlert contain the minimum price that will trigger an alert.
|
||||||
var PriceAlert int64 = 47000
|
var PriceAlert int64 = 47000
|
||||||
|
var ticker int64 = 6
|
||||||
|
|
||||||
var carFilter api.AvailabilityQueryParams = api.AvailabilityQueryParams{
|
var carFilter api.AvailabilityQueryParams = api.AvailabilityQueryParams{
|
||||||
Model: "my",
|
Model: "my",
|
||||||
|
Loading…
Reference in New Issue
Block a user