From 2e3adb5d4fa6bde5022e39ba34d085b909fef3ea Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Fri, 9 Aug 2019 14:20:51 +0700
Subject: [PATCH] Warn on no redis

---
 lib/messages-archive.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/messages-archive.js b/lib/messages-archive.js
index eedc009..3c314c3 100644
--- a/lib/messages-archive.js
+++ b/lib/messages-archive.js
@@ -11,6 +11,14 @@ const DIRECTION_OUTGOING = 1;
 
 const redisClient = config.redis && redis.createClient(config.redis);
 
+if (!config.redis) {
+    logger.warn('Undefined config.redis, messages counter will not work! #05A778E21D7E');
+}
+
+if (!redisClient) {
+    logger.warn('Undefined redisClient, messages counter will not work! #1D3EC165E8D9');
+}
+
 function composeRedisCounterKeyword(origin, direction) {
     const directionLabel = direction == DIRECTION_OUTGOING ? 'OUT' : 'IN';
     return `CALMA_MESSAGE_COUNTER_${origin}_${directionLabel}`;
-- 
1.9.0