Coding the configuration with a class and then enabling it in
`settings.py` is a hurdle especially in devops environments.
Since the `RemoteUserMiddleware` already depends on externally set
environment variable for operation, here's a proposal to make the
environment variable name externally configurable as well, with
`DJANGO_REMOTE_USER_VAR`. That way the specifics of the external
environment can be configured in the configuration of that external
environment, like Apache HTTP Server configuration, without the admins
having to work with Python code. I propose update of the
`RemoteUserMiddleware` behaviour because that way it can be consumed by
subclasses as well.
--
Ticket URL: <https://code.djangoproject.com/ticket/26623>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0
Comment:
Proposed patch at https://github.com/django/django/pull/6616.
--
Ticket URL: <https://code.djangoproject.com/ticket/26623#comment:1>
--
Ticket URL: <https://code.djangoproject.com/ticket/26623#comment:2>
Comment (by aaugustin):
I'm not sure what's wrong with:
{{{
class CustomRemoteUserMiddleware(RemoteUserMiddleware):
header = os.environ['DJANGO_REMOTE_USER_VAR']
}}}
Features are usually configured with settings in Django. In "devops
environments" these settings are initialized from environment variables.
I'm -0 on adding a setting to tackle this specific use case and -1 on
using a environment variable that won't be visible e.g. in `diffsettings`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26623#comment:3>
* status: new => closed
* resolution: => wontfix
Comment:
I fully agree with Aymeric, but I'll go one step further and close the
ticket: I just don't think this use case is common enough to deserve its
own built-in setting. If you need it, it's easy enough to add the class to
your project once, and then never have to think about it again.
--
Ticket URL: <https://code.djangoproject.com/ticket/26623#comment:4>
Comment (by Jan Pazdziora):
For the record, `django-identity-external` in https://github.com/adelton
/django-identity-external / https://pypi.python.org/pypi/django-identity-
external implements this functionality in external middleware.
--
Ticket URL: <https://code.djangoproject.com/ticket/26623#comment:5>