Add Sentinel configuration reading
Added reading Sentinel configuration from environment variables.
Sentinel address is configured via 'DBAAS_SERVICE_HOST' and
'DBAAS_SERVICE_SENTINEL_PORT' environment variables.
Sentinel master name is configured via 'DBAAS_MASTER_NAME' environment
variable.
Sentinel support is now activated.
Using Sentinel is optional. If Sentinel related environment variables
are not set, then static address for Redis server is used as before
(i.e. this change is backward compatible).
Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: I34031ac56268673996c6fecb00eeed6e5dda8b9a
diff --git a/src/hostandport.cpp b/src/hostandport.cpp
index de045ed..ed711c8 100644
--- a/src/hostandport.cpp
+++ b/src/hostandport.cpp
@@ -20,6 +20,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <boost/lexical_cast.hpp>
+#include <ostream>
using namespace shareddatalayer;
@@ -156,3 +157,9 @@
else
return this->getHost() < hp.getHost();
}
+
+std::ostream& shareddatalayer::operator << (std::ostream& os, const HostAndPort& hostAndPort)
+{
+ os << hostAndPort.getHost() << ":" << hostAndPort.getPort();
+ return os;
+}