From 77c37b7cd6357effc9181b9e591784c4a54bf39c Mon Sep 17 00:00:00 2001 From: Ruiwen Chua Date: Thu, 3 Jan 2019 15:10:39 +0800 Subject: [PATCH] fix: allow redis details to be retrieved from environment variables --- misp_modules/helpers/cache.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misp_modules/helpers/cache.py b/misp_modules/helpers/cache.py index 77506fa..3ece927 100644 --- a/misp_modules/helpers/cache.py +++ b/misp_modules/helpers/cache.py @@ -19,12 +19,14 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import os + import redis import hashlib -port = 6379 -hostname = '127.0.0.1' -db = 5 +port = int(os.getenv("REDIS_PORT")) if os.getenv("REDIS_PORT") else 6379 +hostname = os.getenv("REDIS_BACKEND") or '127.0.0.1' +db = int(os.getenv("REDIS_DATABASE")) if os.getenv("REDIS_DATABASE") else 0 def selftest(enable=True):