Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
improved redis endpoint env variable handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreycwitt committed Feb 10, 2020
1 parent a990ff9 commit d4e59c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
volumes:
- ../lbp-print-cache:/usr/src/app/cache
environment:
- REDIS_DOCKER=True
- REDIS_ENDPOINT=redis
queue-worker:
build: .
command: python3 worker.py
Expand Down
2 changes: 1 addition & 1 deletion processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

logger = logging.getLogger()
lbp_config.cache_dir = "cache"
redis_endpoint = "redis" if os.environ.get("REDIS_DOCKER") == "True" else "localhost"
redis_endpoint = os.getenv("REDIS_ENDPOINT", "localhost")
logger.warning(f"Logging redis endpoint: {redis_endpoint}")
redis_connection = Redis(host=redis_endpoint)
q = Queue(connection=redis_connection)
Expand Down
2 changes: 1 addition & 1 deletion worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def start_worker(queues: list = ["default"]):
redis_endpoint = "redis" if os.environ.get("REDIS_DOCKER") == "True" else "localhost"
redis_endpoint = os.getenv("REDIS_ENDPOINT", "localhost")
with Connection():
w = Worker(queues, connection=Redis(host=redis_endpoint))
w.work()
Expand Down

0 comments on commit d4e59c6

Please sign in to comment.