Merge pull request #4 from apache/humbedooh/loggy-multidb

Support both major providers
diff --git a/loggy.py b/loggy.py
index 6378183..c15c26e 100644
--- a/loggy.py
+++ b/loggy.py
@@ -48,6 +48,7 @@
 RSA_KEY = "/etc/ssh/ssh_host_rsa_key.pub"  # RSA public key for SSH. if it exists.
 FINGERPRINT = ""
 FINGERPRINT_SHA = ""
+SUPPORTED_PROVIDERS = ("elasticsearch", "opensearch", )  # Supported database providers to look for in the config
 
 
 def l2fp(txt: str):
@@ -301,8 +302,12 @@
         self.config = parent.config
         self.logger = parent
         self.loggers = {}
+        self.hosts = []
+        for provider in SUPPORTED_PROVIDERS:
+            if provider in parent.config:
+                self.hosts.extend(parent.config[provider].get("hosts", []))
         self.elastic = elasticsearch.Elasticsearch(
-            hosts=parent.config["elasticsearch"]["hosts"], max_retries=5, retry_on_timeout=True
+            hosts=self.hosts, max_retries=5, retry_on_timeout=True
         )
         self.indices = []