Initialize webserver with the listening address.

This commit is contained in:
Cyril Duez 2016-05-27 10:17:11 +02:00
parent 1b71e60d14
commit 580dc733ee
2 changed files with 3 additions and 4 deletions

View File

@ -327,8 +327,7 @@ func (a *Agent) Run(shutdown chan struct{}) error {
// channel shared between all input threads for accumulating metrics // channel shared between all input threads for accumulating metrics
metricC := make(chan telegraf.Metric, 10000) metricC := make(chan telegraf.Metric, 10000)
webserver := webserver.NewWebserver() webserver := webserver.NewWebserver(a.Config.Agent.WebhookServiceAddress)
webserver.ServiceAddress = a.Config.Agent.WebhookServiceAddress
for _, input := range a.Config.Inputs { for _, input := range a.Config.Inputs {
// Start service of any ServicePlugins // Start service of any ServicePlugins

View File

@ -13,8 +13,8 @@ type Webserver struct {
router *mux.Router router *mux.Router
} }
func NewWebserver() *Webserver { func NewWebserver(serviceAddress string) *Webserver {
return &Webserver{router: mux.NewRouter()} return &Webserver{Router: mux.NewRouter(), ServiceAddress: serviceAddress}
} }
func (wb *Webserver) Router() *mux.Router { func (wb *Webserver) Router() *mux.Router {