refactored config names
This commit is contained in:
parent
4659714626
commit
0083207235
@ -8,10 +8,12 @@ xpath_base=.//pdv[@id='%s']/prix[@nom='%s']
|
||||
# Comma separated values for pos and types
|
||||
pos=50000007
|
||||
types=Gazole,SP95,SP98
|
||||
table=fuel_price
|
||||
|
||||
[influxdb]
|
||||
# Influxdb settings
|
||||
influx_host=host
|
||||
influx_db=me
|
||||
influx_port=8086
|
||||
influx_user=influx
|
||||
influx_pass=password
|
||||
hostname=host
|
||||
database=me
|
||||
port=8086
|
||||
username=influx
|
||||
password=password
|
@ -54,7 +54,7 @@ func main() {
|
||||
fields := map[string]interface{}{"value": p.Amount}
|
||||
|
||||
point, _ := client.NewPoint(
|
||||
fpc.InfluxTable,
|
||||
fpc.Table,
|
||||
tags,
|
||||
fields,
|
||||
now,
|
||||
|
14
functions.go
14
functions.go
@ -33,15 +33,17 @@ func GetConfig(configfile string, fuelpricesconfig *FuelPricesConfig) error {
|
||||
fpc.RemoteURL = fuelpricesSection.Key("remote_url").String()
|
||||
fpc.RemoteFilename = fuelpricesSection.Key("remote_filename").String()
|
||||
fpc.XPathBase = fuelpricesSection.Key("xpath_base").String()
|
||||
fpc.InfluxHost = fuelpricesSection.Key("influx_host").String()
|
||||
fpc.InfluxPort, err = fuelpricesSection.Key("influx_port").Int()
|
||||
fpc.Table = fuelpricesSection.Key("table").String()
|
||||
|
||||
influxdbSection := config.Section("influxdb")
|
||||
fpc.InfluxHost = influxdbSection.Key("hostname").String()
|
||||
fpc.InfluxPort, err = influxdbSection.Key("port").Int()
|
||||
HandleError(err)
|
||||
fpc.InfluxUser = fuelpricesSection.Key("influx_user").String()
|
||||
fpc.InfluxPass = fuelpricesSection.Key("influx_pass").String()
|
||||
fpc.InfluxUser = influxdbSection.Key("username").String()
|
||||
fpc.InfluxPass = influxdbSection.Key("password").String()
|
||||
HandleError(err)
|
||||
|
||||
fpc.InfluxDB = fuelpricesSection.Key("influx_db").String()
|
||||
fpc.InfluxTable = fuelpricesSection.Key("influx_table").String()
|
||||
fpc.InfluxDB = influxdbSection.Key("database").String()
|
||||
|
||||
fpc.Pos = fuelpricesSection.Key("pos").Strings(",")
|
||||
fpc.Types = fuelpricesSection.Key("types").Strings(",")
|
||||
|
Loading…
Reference in New Issue
Block a user