Added configuration option to change the probe's listen address.
Change-Id: I7e8aa7bf4a4756f12211e7108cabcdc86aacd78a
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index f9f1d3e..5f4a0e0 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -54,6 +54,7 @@
default_CorePairTopic = "rwcore_1"
default_MaxConnectionRetries = -1 // retries forever
default_ConnectionRetryInterval = 2 // in seconds
+ default_ProbeHost = ""
default_ProbePort = 8080
)
@@ -89,6 +90,7 @@
CorePairTopic string
MaxConnectionRetries int
ConnectionRetryInterval int
+ ProbeHost string
ProbePort int
}
@@ -128,6 +130,7 @@
CorePairTopic: default_CorePairTopic,
MaxConnectionRetries: default_MaxConnectionRetries,
ConnectionRetryInterval: default_ConnectionRetryInterval,
+ ProbeHost: default_ProbeHost,
ProbePort: default_ProbePort,
}
return &rwCoreFlag
@@ -216,6 +219,9 @@
help = fmt.Sprintf("The number of seconds between each connection retry attempt ")
flag.IntVar(&(cf.ConnectionRetryInterval), "connection_retry_interval", default_ConnectionRetryInterval, help)
+ help = fmt.Sprintf("The host on which to listen to answer liveness and readiness probe queries over HTTP.")
+ flag.StringVar(&(cf.ProbeHost), "probe_host", default_ProbeHost, help)
+
help = fmt.Sprintf("The port on which to listen to answer liveness and readiness probe queries over HTTP.")
flag.IntVar(&(cf.ProbePort), "probe_port", default_ProbePort, help)
diff --git a/rw_core/main.go b/rw_core/main.go
index 6f06576..2311029 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -276,7 +276,7 @@
* objects there can be a single probe end point for the process.
*/
p := &probe.Probe{}
- go p.ListenAndServe(rw.config.ProbePort)
+ go p.ListenAndServe(fmt.Sprintf("%s:%d", rw.config.ProbeHost, rw.config.ProbePort))
// Add the probe to the context to pass to all the services started
probeCtx := context.WithValue(ctx, probe.ProbeContextKey, p)