updates on influxdb url
This commit is contained in:
parent
72e5b16b7a
commit
966a6355d9
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${fileDirname}",
|
||||
"env": {},
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
}
|
@ -16,8 +16,7 @@ go build
|
||||
|
||||
```ini
|
||||
[influxdb]
|
||||
hostname=influxdb
|
||||
port=8086
|
||||
url=http://influxdb:8086/
|
||||
username=influxdb
|
||||
password=password
|
||||
database=database
|
||||
|
@ -37,8 +37,7 @@ func GetConfig(weatherconfig *WeatherConfig, configfile string) error {
|
||||
}
|
||||
|
||||
influxdbSection := config.Section("influxdb")
|
||||
wc.InfluxHost = influxdbSection.Key("hostname").MustString("localhost")
|
||||
wc.InfluxPort = influxdbSection.Key("port").MustInt(8086)
|
||||
wc.InfluxURL = influxdbSection.Key("url").MustString("http://localhost:8086")
|
||||
wc.InfluxUser = influxdbSection.Key("username").MustString("username")
|
||||
wc.InfluxPass = influxdbSection.Key("password").MustString("password")
|
||||
wc.InfluxDB = influxdbSection.Key("database").MustString("me")
|
||||
@ -86,9 +85,8 @@ func FetchData(wc *WeatherConfig, city string) (Data, error) {
|
||||
// SendToInflux sends time series data to influxdb
|
||||
func SendToInflux(wc *WeatherConfig, d Data) error {
|
||||
|
||||
wc.InfluxAddr = fmt.Sprintf("http://%s:%d", wc.InfluxHost, wc.InfluxPort)
|
||||
httpClient, err := client.NewHTTPClient(client.HTTPConfig{
|
||||
Addr: wc.InfluxAddr,
|
||||
Addr: wc.InfluxURL,
|
||||
Username: wc.InfluxUser,
|
||||
Password: wc.InfluxPass,
|
||||
})
|
||||
|
3
types.go
3
types.go
@ -5,8 +5,7 @@ type WeatherConfig struct {
|
||||
WeatherAppID string
|
||||
WeatherCities []string
|
||||
WeatherMeasurements []string
|
||||
InfluxHost string
|
||||
InfluxPort int
|
||||
InfluxURL string
|
||||
InfluxAddr string
|
||||
InfluxUser string
|
||||
InfluxPass string
|
||||
|
@ -1,6 +1,5 @@
|
||||
[influxdb]
|
||||
hostname=influxdb
|
||||
port=8086
|
||||
url=http://influxdb:8086/
|
||||
username=influxdb
|
||||
password=password
|
||||
database=database
|
||||
|
Loading…
Reference in New Issue
Block a user