summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2017-07-05 02:10:12 +0200
committerChristian Pointner <equinox@spreadspace.org>2017-07-05 02:10:12 +0200
commit493ac2b4441f44296da4efb1a9df04bebd884f99 (patch)
tree22d3feba67e65067569958d3e6a0b7f07bf24f24
parentsome more logging cleanup (diff)
forwarder now use config structs as well
-rw-r--r--src/hub/src/spreadspace.org/sfive-hub/s5hub.go16
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForward.go7
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go7
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForwardGraphite.go7
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go7
5 files changed, 24 insertions, 20 deletions
diff --git a/src/hub/src/spreadspace.org/sfive-hub/s5hub.go b/src/hub/src/spreadspace.org/sfive-hub/s5hub.go
index 016976d..ba34697 100644
--- a/src/hub/src/spreadspace.org/sfive-hub/s5hub.go
+++ b/src/hub/src/spreadspace.org/sfive-hub/s5hub.go
@@ -132,9 +132,7 @@ func main() {
wg.Add(1)
go func() {
defer wg.Done()
- s5hl.Println("starting forward")
- srv.RunForwarding(cfg.Forwards.SFive.URL)
- s5hl.Println("forward finished")
+ srv.RunForwarding(cfg.Forwards.SFive)
}()
}
@@ -142,9 +140,7 @@ func main() {
wg.Add(1)
go func() {
defer wg.Done()
- s5hl.Println("starting elastic-search forward")
- srv.RunForwardingEs(cfg.Forwards.Elasticsearch.URL)
- s5hl.Println("elastic-search forward finished")
+ srv.RunForwardingEs(cfg.Forwards.Elasticsearch)
}()
}
@@ -152,9 +148,7 @@ func main() {
wg.Add(1)
go func() {
defer wg.Done()
- s5hl.Println("starting graphite forward")
- srv.RunForwardingGraphite(cfg.Forwards.Graphite.Host, cfg.Forwards.Graphite.BasePath)
- s5hl.Println("graphite forward finished")
+ srv.RunForwardingGraphite(cfg.Forwards.Graphite)
}()
}
@@ -162,9 +156,7 @@ func main() {
wg.Add(1)
go func() {
defer wg.Done()
- s5hl.Println("starting piwik forward")
- srv.RunForwardingPiwik(cfg.Forwards.Piwik.URL, cfg.Forwards.Piwik.SiteURL, cfg.Forwards.Piwik.SiteID, cfg.Forwards.Piwik.AuthConfig.Token)
- s5hl.Println("piwik forward finished")
+ srv.RunForwardingPiwik(cfg.Forwards.Piwik)
}()
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForward.go b/src/hub/src/spreadspace.org/sfive/s5srvForward.go
index a3e5c1f..094a1a8 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForward.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForward.go
@@ -151,6 +151,9 @@ tryResync:
}
}
-func (srv Server) RunForwarding(forwardBaseUrl string) {
- srv.forwardRun(forwardBaseUrl, http.DefaultClient)
+func (srv Server) RunForwarding(cfg SFiveForwardConfig) {
+ s5l.Printf("srv|fwd: forwarding to '%s'", cfg.URL)
+ defer s5l.Println("srv|fwd: forwarder stopped")
+
+ srv.forwardRun(cfg.URL, http.DefaultClient)
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go
index 71313aa..02a6470 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardEs.go
@@ -159,6 +159,9 @@ tryResync:
}
}
-func (srv Server) RunForwardingEs(forwardBaseUrl string) {
- srv.forwardEsRun(forwardBaseUrl, http.DefaultClient)
+func (srv Server) RunForwardingEs(cfg ESForwardConfig) {
+ s5l.Printf("srv|fwd-es: forwarding to '%s'", cfg.URL)
+ defer s5l.Println("srv|fwd-es: forwarder stopped")
+
+ srv.forwardEsRun(cfg.URL, http.DefaultClient)
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardGraphite.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardGraphite.go
index 90afb69..d0c07d5 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForwardGraphite.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardGraphite.go
@@ -96,6 +96,9 @@ tryResync:
}
}
-func (srv Server) RunForwardingGraphite(forwardHost string, basePath string) {
- srv.forwardGraphiteRun(forwardHost, basePath)
+func (srv Server) RunForwardingGraphite(cfg GraphiteForwardConfig) {
+ s5l.Printf("srv|fwd-graphite: forwarding to '%s'", cfg.Host)
+ defer s5l.Println("srv|fwd-graphite: forwarder stopped")
+
+ srv.forwardGraphiteRun(cfg.Host, cfg.BasePath)
}
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
index 198a53c..f3f71e7 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
@@ -138,6 +138,9 @@ tryResync:
}
}
-func (srv Server) RunForwardingPiwik(piwikURL, siteURL string, siteID uint, piwikToken string) {
- srv.forwardPiwikRun(piwikURL, siteURL, siteID, piwikToken, http.DefaultClient)
+func (srv Server) RunForwardingPiwik(cfg PiwikForwardConfig) {
+ s5l.Printf("srv|fwd-piwik: forwarding to '%s'", cfg.URL)
+ defer s5l.Println("srv|fwd-piwik: forwarder stopped")
+
+ srv.forwardPiwikRun(cfg.URL, cfg.SiteURL, cfg.SiteID, cfg.AuthConfig.Token, http.DefaultClient)
}