Skip to content

Commit

Permalink
check REDIS_HOST before access
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Dec 13, 2023
1 parent 6eeb256 commit b9909b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions foursight_core/react/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def get_redis_handler(self):
# 2023-09-21: Moved this from __init__ to here;
# it speeds up provision/deploy from 4dn-cloud-infra.
try:
redis_url = os.environ['REDIS_HOST']
if redis_url and ("redis://" in redis_url or "rediss://" in redis_url):
if (redis_url := os.environ.get('REDIS_HOST')) and ("redis://" in redis_url or "rediss://" in redis_url):
self._redis = RedisBase(create_redis_client(url=redis_url))
except (redis.exceptions.ConnectionError, redis.exceptions.TimeoutError):
PRINT('Cannot connect to Redis')
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "foursight-core"
version = "5.1.0.1b3" # TODO: To become 5.2.0
version = "5.1.0.1b4" # TODO: To become 5.2.0
description = "Serverless Chalice Application for Monitoring"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit b9909b7

Please sign in to comment.