config update

This commit is contained in:
simon 2019-12-12 21:40:08 -05:00
parent 94fcc6ae8d
commit 5fa1b8c0eb
3 changed files with 22 additions and 0 deletions

View File

@ -4,6 +4,9 @@
"wait": "0.5s",
"multiplier": 1,
"retries": 3,
"influx_url": "http://localhost:8086",
"influx_user": "",
"influx_pass": "",
"max_error": 0.4,
"redis_url": "localhost:6379",
"hosts": [

16
main.go
View File

@ -289,5 +289,21 @@ func main() {
balancer := New()
balancer.reloadConfig()
var err error
balancer.influxdb, err = influx.NewHTTPClient(influx.HTTPConfig{
Addr: config.InfluxUrl,
Username: config.InfluxUser,
Password: config.InfluxPass,
})
_, err = http.Post(config.InfluxUrl+"/query", "application/x-www-form-urlencoded", strings.NewReader("q=CREATE DATABASE \"architeuthis\""))
if err != nil {
panic(err)
}
balancer.points = make(chan *influx.Point, InfluxDbBufferSize)
go balancer.asyncWriter(balancer.points)
balancer.Run()
}

View File

@ -209,4 +209,7 @@ var config struct {
Timeout time.Duration
DefaultConfig *HostConfig
Routing bool
InfluxUrl string `json:"influx_url"`
InfluxUser string `json:"influx_user"`
InfluxPass string `json:"influx_pass"`
}