Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

celeryconfig.py: parse a bool from BROKER_USE_SSL environment variable. #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion celeryconfig.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
import os


# One always get a string from env and need to convert to bool.
def get_bool_from_env(key, default):
try:
val = os.environ[key]
except KeyError:
return default
else:
if val == "True":
return True
elif val == "False":
return False
else:
raise ValueError(
"'%s' value should be string 'False' or 'True' (was '%s')"
% (key, val)
)


BROKER_URL = os.environ.get('BROKER_URL')
BROKER_USE_SSL = os.environ.get('BROKER_USE_SSL', False)
BROKER_USE_SSL = get_bool_from_env('BROKER_USE_SSL', False)
CELERY_IMPORTS = ('worker',)
CELERY_TASK_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ('json',)
Expand Down