You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/03/28 18:27:18 UTC

[incubator-ponymail-foal] branch master updated: Prefer single URL, fall back to host+port+etc if not found

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b07df4  Prefer single URL, fall back to host+port+etc if not found
8b07df4 is described below

commit 8b07df4e7db47dbdde38bceadbfeac7259767a90
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Mar 28 20:27:09 2021 +0200

    Prefer single URL, fall back to host+port+etc if not found
---
 server/plugins/database.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/server/plugins/database.py b/server/plugins/database.py
index f033a35..32aef47 100644
--- a/server/plugins/database.py
+++ b/server/plugins/database.py
@@ -49,14 +49,17 @@ class Database:
         self.config = config
         self.uuid = str(uuid.uuid4())
         self.dbs = DBNames(config.db_prefix)
+        dburl = self.config.dburl
+        if not dburl:
+            dburl = {
+                "host": config.hostname,
+                "port": config.port,
+                "url_prefix": config.url_prefix or "",
+                "use_ssl": config.secure,
+            }
         self.client = elasticsearch.AsyncElasticsearch(
             [
-                {
-                    "host": config.hostname,
-                    "port": config.port,
-                    "url_prefix": config.url_prefix or "",
-                    "use_ssl": config.secure,
-                },
+                dburl
             ]
         )