Skip to content
Snippets Groups Projects
Commit e4e8f7b4 authored by Art's avatar Art :lizard:
Browse files

Add config for SSL and broker port. Not sure whether SSL works though.

parent 73f20f7c
Branches
No related tags found
No related merge requests found
...@@ -11,7 +11,8 @@ from datetime import timedelta ...@@ -11,7 +11,8 @@ from datetime import timedelta
# stuff you want to change: # stuff you want to change:
BROKER = "localhost" BROKER_HOST = "localhost"
BROKER_PORT = "5672"
VIRTUAL_HOST = "vhost" VIRTUAL_HOST = "vhost"
USERNAME = "user" USERNAME = "user"
PASSWORD = "password" PASSWORD = "password"
...@@ -20,6 +21,15 @@ CLIENT_EXCHANGE_NAME = "" # empty string -> amq.default exchange ...@@ -20,6 +21,15 @@ CLIENT_EXCHANGE_NAME = "" # empty string -> amq.default exchange
WORKER_TASK_PROCESSES = 10 # this many processes will be executing tasks WORKER_TASK_PROCESSES = 10 # this many processes will be executing tasks
SSL_ENABLED = True
SSL_CONF = {
# # See ssl.wrap_socket() documentation: https://docs.python.org/3.6/library/ssl.html#ssl.wrap_socket
# "keyfile": "/foo/client/key.pem",
# "certfile": "/foo/client/cert.pem",
# "ca_certs": "/foo/ca/cacert.pem",
# "ssl_version": ssl.PROTOCOL_TLSv1_2,
# "cert_reqs": ssl.CERT_NONE,
}
# stuff you might want to change sometimes: # stuff you might want to change sometimes:
RPC_TIMEOUT = timedelta(seconds=10) # affects client behaviour and message TTL RPC_TIMEOUT = timedelta(seconds=10) # affects client behaviour and message TTL
......
...@@ -17,10 +17,16 @@ def deserialize(binary): ...@@ -17,10 +17,16 @@ def deserialize(binary):
def get_pika_connection_parameters(): def get_pika_connection_parameters():
return pika.ConnectionParameters( return pika.ConnectionParameters(
host=settings.BROKER, host=settings.BROKER_HOST,
port=int(settings.BROKER_PORT),
virtual_host=settings.VIRTUAL_HOST, virtual_host=settings.VIRTUAL_HOST,
credentials=pika.PlainCredentials(username=settings.USERNAME, password=settings.PASSWORD), credentials=pika.PlainCredentials(
username=settings.USERNAME,
password=settings.PASSWORD
),
blocked_connection_timeout=settings.BLOCKED_CONNECTION_TIMEOUT.total_seconds(), # TODO: causes a warning when closing connections blocked_connection_timeout=settings.BLOCKED_CONNECTION_TIMEOUT.total_seconds(), # TODO: causes a warning when closing connections
ssl=settings.SSL_ENABLED,
ssl_options=settings.SSL_CONF,
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment