Tweak settings.py to allow for TRUST-based PostgreSQL auth

This commit is contained in:
Daniel Quinn 2018-09-23 14:01:15 +01:00
parent d17497fd5b
commit b20d7eca03

View File

@ -144,13 +144,14 @@ DATABASES = {
} }
} }
if os.getenv("PAPERLESS_DBUSER") and os.getenv("PAPERLESS_DBPASS"): if os.getenv("PAPERLESS_DBUSER"):
DATABASES["default"] = { DATABASES["default"] = {
"ENGINE": "django.db.backends.postgresql_psycopg2", "ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": os.getenv("PAPERLESS_DBNAME", "paperless"), "NAME": os.getenv("PAPERLESS_DBNAME", "paperless"),
"USER": os.getenv("PAPERLESS_DBUSER"), "USER": os.getenv("PAPERLESS_DBUSER"),
"PASSWORD": os.getenv("PAPERLESS_DBPASS")
} }
if os.getenv("PAPERLESS_DBPASS"):
DATABASES["default"]["PASSWORD"] = os.getenv("PAPERLESS_DBPASS")
# Password validation # Password validation