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/redis/asyncsentineldatabasediscovery.cpp b/src/redis/asyncsentineldatabasediscovery.cpp
index be51c5e..7c06f15 100644
--- a/src/redis/asyncsentineldatabasediscovery.cpp
+++ b/src/redis/asyncsentineldatabasediscovery.cpp
@@ -56,9 +56,13 @@
 }
 
 AsyncSentinelDatabaseDiscovery::AsyncSentinelDatabaseDiscovery(std::shared_ptr<Engine> engine,
-                                                               std::shared_ptr<Logger> logger):
+                                                               std::shared_ptr<Logger> logger,
+                                                               const HostAndPort& sentinelAddress,
+                                                               const std::string& sentinelMasterName):
         AsyncSentinelDatabaseDiscovery(engine,
                                        logger,
+                                       sentinelAddress,
+                                       sentinelMasterName,
                                        ::asyncCommandDispatcherCreator,
                                        std::make_shared<redis::ContentsBuilder>(AsyncStorage::SEPARATOR))
 {
@@ -66,15 +70,17 @@
 
 AsyncSentinelDatabaseDiscovery::AsyncSentinelDatabaseDiscovery(std::shared_ptr<Engine> engine,
                                                                std::shared_ptr<Logger> logger,
+                                                               const HostAndPort& sentinelAddress,
+                                                               const std::string& sentinelMasterName,
                                                                const AsyncCommandDispatcherCreator& asyncCommandDispatcherCreator,
                                                                std::shared_ptr<redis::ContentsBuilder> contentsBuilder):
         engine(engine),
         logger(logger),
-        // @TODO Make configurable.
-        databaseInfo(DatabaseInfo({DatabaseConfiguration::Addresses({HostAndPort("dbaas-ha", htons(26379U))}),
+        databaseInfo(DatabaseInfo({DatabaseConfiguration::Addresses({sentinelAddress}),
                      DatabaseInfo::Type::SINGLE,
                      boost::none,
                      DatabaseInfo::Discovery::SENTINEL})),
+        sentinelMasterName(sentinelMasterName),
         contentsBuilder(contentsBuilder),
         subscribeRetryTimer(*engine),
         subscribeRetryTimerDuration(std::chrono::seconds(1)),
@@ -181,7 +187,7 @@
                                         std::placeholders::_1,
                                         std::placeholders::_2),
                               "dummyNamespace", // Not meaningful for Sentinel
-                              contentsBuilder->build("SENTINEL", "get-master-addr-by-name", "mymaster")); //@TODO Make master name configurable
+                              contentsBuilder->build("SENTINEL", "get-master-addr-by-name", sentinelMasterName));
 }
 
 void AsyncSentinelDatabaseDiscovery::masterInquiryAck(const std::error_code& error,