Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pikatasks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
django
pikatasks
Commits
5375ac9e
Commit
5375ac9e
authored
7 years ago
by
Dennis Ahrens
Browse files
Options
Downloads
Patches
Plain Diff
SSL Settings are no longer a dictionary
parent
9c6f15a0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pikatasks/settings.py
+6
-15
6 additions, 15 deletions
pikatasks/settings.py
pikatasks/utils.py
+6
-6
6 additions, 6 deletions
pikatasks/utils.py
with
12 additions
and
21 deletions
pikatasks/settings.py
+
6
−
15
View file @
5375ac9e
...
...
@@ -23,16 +23,11 @@ CLIENT_EXCHANGE_NAME = "" # empty string -> amq.default exchange
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",
# NOTE: The following values are not meant to be changed through settings
# because this would be a mess in deployment!
"
ssl_version
"
:
ssl
.
PROTOCOL_TLSv1_2
,
"
cert_reqs
"
:
ssl
.
CERT_REQUIRED
,
}
SSL_KEY_FILE
=
None
SSL_CERT_FILE
=
None
SSL_CA_CERTS
=
None
SSL_VERSION
=
ssl
.
PROTOCOL_TLSv1_2
SSL_CERT_REQS
=
ssl
.
CERT_REQUIRED
# stuff you might want to change sometimes:
RPC_TIMEOUT
=
timedelta
(
seconds
=
10
)
# affects client behaviour and message TTL
...
...
@@ -51,10 +46,6 @@ try:
if
k
.
isupper
()
and
not
k
.
startswith
(
"
_
"
):
# looks like a setting
try
:
new_value
=
getattr
(
django_settings
,
"
PIKATASKS_
"
+
k
)
if
isinstance
(
globals
()[
k
],
dict
):
assert
isinstance
(
new_value
,
dict
),
"
{} needs to be a dictionary
"
.
format
(
k
)
globals
()[
k
].
update
(
new_value
)
else
:
globals
()[
k
]
=
new_value
except
ImproperlyConfigured
:
pass
# django is installed but not used
...
...
This diff is collapsed.
Click to expand it.
pikatasks/utils.py
+
6
−
6
View file @
5375ac9e
...
...
@@ -16,12 +16,12 @@ def deserialize(binary):
return
json
.
loads
(
binary
.
decode
(
"
utf-8
"
))
def
get_ssl_options
(
ssl_
settings
):
def
get_ssl_options
(
settings
):
"""
Create pika.SSLOptions based on pikatasks settings.
"""
context
=
ssl
.
SSLContext
(
ssl_
settings
.
get
(
'
ssl_version
'
)
)
context
.
verify_mode
=
(
ssl_
settings
.
get
(
'
cert_reqs
'
))
context
.
load_verify_locations
(
ssl_
settings
.
get
(
'
ca_certs
'
)
)
context
.
load_cert_chain
(
ssl_
settings
.
get
(
'
certfile
'
),
ssl_settings
.
get
(
'
keyfile
'
)
)
context
=
ssl
.
SSLContext
(
settings
.
SSL_VERSION
)
context
.
verify_mode
=
settings
.
SSL_CERT_REQS
context
.
load_verify_locations
(
settings
.
SSL_CA_CERTS
)
context
.
load_cert_chain
(
settings
.
SSL_CERT_FILE
,
settings
.
SSL_KEY_FILE
)
return
pika
.
SSLOptions
(
context
)
...
...
@@ -36,7 +36,7 @@ def get_pika_connection_parameters():
),
# TODO: causes a warning when closing connections
blocked_connection_timeout
=
settings
.
BLOCKED_CONNECTION_TIMEOUT
.
total_seconds
(),
ssl_options
=
get_ssl_options
(
settings
.
SSL_CONF
)
if
settings
.
SSL_ENABLED
else
None
,
ssl_options
=
get_ssl_options
(
settings
)
if
settings
.
SSL_ENABLED
else
None
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment