From f3b46f50bf21c078f54f7645c145cf8b056bf128 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 6 Jan 2021 16:53:58 +0100 Subject: [PATCH] move settings --- src/paperless/settings.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/paperless/settings.py b/src/paperless/settings.py index 1c3846f9a..8c91938aa 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -129,20 +129,6 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ENABLE_HTTP_REMOTE_USER = __get_boolean("PAPERLESS_ENABLE_HTTP_REMOTE_USER") - -if ENABLE_HTTP_REMOTE_USER: - MIDDLEWARE.append( - 'paperless.auth.HttpRemoteUserMiddleware' - ) - AUTHENTICATION_BACKENDS = [ - 'django.contrib.auth.backends.RemoteUserBackend', - 'django.contrib.auth.backends.ModelBackend' - ] - REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'].append( - 'rest_framework.authentication.RemoteUserAuthentication' - ) - ROOT_URLCONF = 'paperless.urls' FORCE_SCRIPT_NAME = os.getenv("PAPERLESS_FORCE_SCRIPT_NAME") @@ -180,6 +166,19 @@ if AUTO_LOGIN_USERNAME: # regular login in case the provided user does not exist. MIDDLEWARE.insert(_index+1, 'paperless.auth.AutoLoginMiddleware') +ENABLE_HTTP_REMOTE_USER = __get_boolean("PAPERLESS_ENABLE_HTTP_REMOTE_USER") + +if ENABLE_HTTP_REMOTE_USER: + MIDDLEWARE.append( + 'paperless.auth.HttpRemoteUserMiddleware' + ) + AUTHENTICATION_BACKENDS = [ + 'django.contrib.auth.backends.RemoteUserBackend', + 'django.contrib.auth.backends.ModelBackend' + ] + REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'].append( + 'rest_framework.authentication.RemoteUserAuthentication' + ) # We allow CORS from localhost:8080 CORS_ALLOWED_ORIGINS = tuple(os.getenv("PAPERLESS_CORS_ALLOWED_HOSTS", "http://localhost:8000").split(","))