Merge lp:~cjwatson/convoy/wsgi-environ into lp:~launchpad/convoy/packaging

Proposed by Colin Watson
Status: Merged
Merged at revision: 35
Proposed branch: lp:~cjwatson/convoy/wsgi-environ
Merge into: lp:~launchpad/convoy/packaging
Diff against target: 34 lines (+16/-1)
2 files modified
debian/changelog (+7/-0)
debian/convoy.wsgi (+9/-1)
To merge this branch: bzr merge lp:~cjwatson/convoy/wsgi-environ
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+331611@code.launchpad.net

Commit message

CONVOY_ROOT comes from the request environment under mod_wsgi. Adjust
the previous change so that it copes with both mod_wsgi and gunicorn.

To post a comment you must log in.
lp:~cjwatson/convoy/wsgi-environ updated
36. By Colin Watson

Fix indentation.

Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-09-20 11:25:00 +0000
3+++ debian/changelog 2017-09-30 01:09:32 +0000
4@@ -1,3 +1,10 @@
5+convoy (0.4.4+bzr39-0lp4) UNRELEASED; urgency=medium
6+
7+ * CONVOY_ROOT comes from the request environment under mod_wsgi. Adjust
8+ the previous change so that it copes with both mod_wsgi and gunicorn.
9+
10+ -- Colin Watson <cjwatson@ubuntu.com> Fri, 29 Sep 2017 21:06:49 -0400
11+
12 convoy (0.4.4+bzr39-0lp3) xenial; urgency=medium
13
14 * Fix CONVOY_ROOT handling in convoy.wsgi: this must come from the process
15
16=== modified file 'debian/convoy.wsgi'
17--- debian/convoy.wsgi 2017-09-20 11:23:56 +0000
18+++ debian/convoy.wsgi 2017-09-30 01:09:32 +0000
19@@ -19,6 +19,14 @@
20 from convoy.combo import combo_app
21
22 def application(environ, start_response):
23- root = os.environ.get('CONVOY_ROOT', '/srv/launchpad.dev/convoy')
24+ # CONVOY_ROOT may be set by SetEnv in Apache configuration, in which
25+ # case mod_wsgi passes it in the request environment. (This is safe
26+ # because HTTP headers end up in HTTP_*.)
27+ root = environ.get('CONVOY_ROOT')
28+ if root is None:
29+ # Alternatively, convoy may be run under a standalone WSGI server
30+ # such as gunicorn, in which case we need to look for CONVOY_ROOT in
31+ # the process environment.
32+ root = os.environ.get('CONVOY_ROOT', '/srv/launchpad.dev/convoy')
33 app = combo_app(root)
34 return app(environ, start_response)

Subscribers

People subscribed via source and target branches