From 42585e3d99f3fc00eb59f0d4fc5460aab707789a Mon Sep 17 00:00:00 2001 From: paulbsd Date: Wed, 24 Jul 2019 09:43:59 +0200 Subject: [PATCH 1/4] Update 'README.md' --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c0fd211..0722073 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,16 @@ # fuelprices +## Summary +fuelprices is a small tool designed to fetch fuel prices from France open data and send them to influxdb + +## Build +```shell +go build +``` ## Usage ```shell -fuelprices -configfile fuelprices.ini +./fuelprices -configfile fuelprices.ini ``` ## Sample config From 7be2a5a37841a3cac12c2dd2b9627ecb781e1844 Mon Sep 17 00:00:00 2001 From: paulbsd Date: Wed, 24 Jul 2019 09:46:37 +0200 Subject: [PATCH 2/4] Update 'README.md' --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0722073..f572306 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,23 @@ # fuelprices ## Summary + fuelprices is a small tool designed to fetch fuel prices from France open data and send them to influxdb -## Build +## Howto + +### Build + ```shell go build ``` -## Usage +### Usage ```shell ./fuelprices -configfile fuelprices.ini ``` -## Sample config +### Sample config ```ini [fuelprices] From 99ce74161a6522c1c3c95b3fc67387b1d78418c5 Mon Sep 17 00:00:00 2001 From: paulbsd Date: Wed, 24 Jul 2019 09:48:34 +0200 Subject: [PATCH 3/4] Update 'README.md' --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f572306..5eca5cf 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,7 @@ fuelprices is a small tool designed to fetch fuel prices from France open data a go build ``` -### Usage - -```shell -./fuelprices -configfile fuelprices.ini -``` - -### Sample config +### Sample config in fuelprices.ini ```ini [fuelprices] @@ -39,6 +33,12 @@ username=influx password=password ``` +### Run + +```shell +./fuelprices -configfile fuelprices.ini +``` + ## License ```text From 329f1c7752d61b932e179be3884a1824a1393d6c Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Thu, 22 Aug 2019 09:57:43 +0200 Subject: [PATCH 4/4] chore: added defer for influxdb connection --- functions.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions.go b/functions.go index a1a5313..d260f30 100644 --- a/functions.go +++ b/functions.go @@ -74,7 +74,6 @@ func DownloadFile(fpc *FuelPricesConfig, zipfile *ZipFile) error { if err != nil { return err } - defer resp.Body.Close() zipfile.Content, err = ioutil.ReadAll(resp.Body) @@ -153,6 +152,8 @@ func SendToInflux(fpc *FuelPricesConfig, prices *[]Price) error { return err } + defer httpClient.Close() + bp, err := client.NewBatchPoints(client.BatchPointsConfig{ Database: fpc.InfluxDB, })