From 580dc733ee44da99f0acc4b6adf35c5d443a5128 Mon Sep 17 00:00:00 2001 From: Cyril Duez Date: Fri, 27 May 2016 10:17:11 +0200 Subject: [PATCH] Initialize webserver with the listening address. --- agent/agent.go | 3 +-- internal/webserver/webserver.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 2806c0013..43bec8837 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -327,8 +327,7 @@ func (a *Agent) Run(shutdown chan struct{}) error { // channel shared between all input threads for accumulating metrics metricC := make(chan telegraf.Metric, 10000) - webserver := webserver.NewWebserver() - webserver.ServiceAddress = a.Config.Agent.WebhookServiceAddress + webserver := webserver.NewWebserver(a.Config.Agent.WebhookServiceAddress) for _, input := range a.Config.Inputs { // Start service of any ServicePlugins diff --git a/internal/webserver/webserver.go b/internal/webserver/webserver.go index ad574ca86..4e3266094 100644 --- a/internal/webserver/webserver.go +++ b/internal/webserver/webserver.go @@ -13,8 +13,8 @@ type Webserver struct { router *mux.Router } -func NewWebserver() *Webserver { - return &Webserver{router: mux.NewRouter()} +func NewWebserver(serviceAddress string) *Webserver { + return &Webserver{Router: mux.NewRouter(), ServiceAddress: serviceAddress} } func (wb *Webserver) Router() *mux.Router {