From 04ca0ae5dbf92b88056284bfbc389e157a8f4ca6 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Mon, 9 May 2022 16:32:35 +0200 Subject: [PATCH] feat(config): allow specifying engine-specific database options (#135) These are required to e.g. use PostgreSQL client certificates using sslcert=/sslkey=. --- etebase-server.ini.example | 3 +++ etebase_server/settings.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/etebase-server.ini.example b/etebase-server.ini.example index 4f4b456..3245e6c 100644 --- a/etebase-server.ini.example +++ b/etebase-server.ini.example @@ -18,3 +18,6 @@ allowed_host1 = example.com [database] engine = django.db.backends.sqlite3 name = db.sqlite3 + +[database-options] +; Add engine-specific options here, such as postgresql parameter key words diff --git a/etebase_server/settings.py b/etebase_server/settings.py index 42ded0b..07a50b0 100644 --- a/etebase_server/settings.py +++ b/etebase_server/settings.py @@ -164,6 +164,9 @@ if any(os.path.isfile(x) for x in config_locations): if "database" in config: DATABASES = {"default": {x.upper(): y for x, y in config.items("database")}} + if "database-options" in config: + DATABASES["default"]["OPTIONS"] = config["database-options"] + ETEBASE_CREATE_USER_FUNC = "django_etebase.utils.create_user_blocked" # Efficient file streaming (for large files)