Skip to content

Instantly share code, notes, and snippets.

@tommling
Created August 15, 2018 20:35
Show Gist options
  • Save tommling/70475667fcbef5c4fe2a90bc88d92562 to your computer and use it in GitHub Desktop.
Save tommling/70475667fcbef5c4fe2a90bc88d92562 to your computer and use it in GitHub Desktop.
""" Message Queue Stuff """
MQ_PROTOCOL = os.environ.get('MQ_PROTOCOL', 'amqp')
MQ_USER = os.environ.get(
'MQ_USER', 'makecents')
MQ_PASS = os.environ.get(
'MQ_PASS', 'makecents')
MQ_HOST = os.environ.get('MQ_HOST', 'localhost')
MQ_PORT = os.environ.get('MQ_PORT', '5672')
NEW_MQ_NAME = 'makecents'
MQ_CONFIG_DICT = {
'protocol': MQ_PRTOCOL
'vhost': MQ_VHOST
'user': MQ_USER,
'password': MQ_PASS,
'host': MQ_HOST,
'port': MQ_PORT
}
MQ_CONN_FORMAT = '{protocol}://{user}:{password}@{host}:{port}/{vhost}'
MQ_URI_DEFAULT = (MQ_CONN_FORMAT.format(
**MQ_CONFIG_DICT))
# This should be the whole MQ_CONN_FORMAT
SOCKETIO_MESSAGE_QUEUE = os.environ.get(
'SOCKETIO_MESSAGE_QUEUE', MQ_UR_DEFAULT)
""" CELERY CONF """
# TODO we need to pass the basic auth info to CELERY_BROKER_URL/BACKEND.
CELERY_BROKER_URL = os.environ.get(
'CELERY_BROKER_URL',
MQ_URI_DEFAULT) # MQ_CONN_URI_NEW)
CELERY_RESULT_BACKEND = os.environ.get(
'CELERY_RESULT_BACKEND',
MQ_URI_DEFAULT) # MQ_CONN_URI_NEW)
CELERY_CONFIG = {
'CELERY_RESULT_BACKEND': CELERY_RESULT_BACKEND,
'CELERY_BROKER_URL': CELERY_BROKER_URL}
CELERY_CONN_URI_DEFAULT = (MQ_CONN_FORMAT.format(
**MQ_CONFIG_DICT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment