From 2855e5b9b678c13f9ff524fca02411fcd348d153 Mon Sep 17 00:00:00 2001 From: Nicholas Charriere Date: Sun, 21 Aug 2016 09:05:01 +0200 Subject: [PATCH] Add env var options --- README.rst | 4 ++++ snappass/main.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index e8dc2cf..593de48 100644 --- a/README.rst +++ b/README.rst @@ -62,6 +62,10 @@ need to change this. `REDIS_HOST` this should be set by Redis, but you can override it if you want. Defaults to `"localhost"` +`REDIS_PORT` is the port redis is serving on, defaults to 6379 + +`SNAPPASS_REDIS_DB` is the database that you want to use on this redis server. Defaults to db 0 + Docker ------ diff --git a/snappass/main.py b/snappass/main.py index ee9b77e..03b35ca 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -13,7 +13,9 @@ app.config.update( dict(STATIC_URL=os.environ.get('STATIC_URL', 'static'))) redis_host = os.environ.get('REDIS_HOST', 'localhost') -redis_client = redis.StrictRedis(host=redis_host, port=6379, db=0) +redis_port = os.environ.get('REDIS_PORT', 6379) +redis_db = os.environ.get('SNAPPASS_REDIS_DB', 0) +redis_client = redis.StrictRedis(host=redis_host, port=redis_port, db=redis_db) time_conversion = { 'week': 604800,