From 1ff804ab5eb0959ea777cd125c66b1d54ef08961 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 30 Oct 2023 13:54:17 +0100 Subject: [PATCH] Make opensearch protocol configurable (#661) Part of osism/issues#731 Signed-off-by: Christian Berendt --- osism/commands/log.py | 2 +- osism/settings.py | 1 + .../notes/opensearch-protocol-c222c86a24ac594c.yaml | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/opensearch-protocol-c222c86a24ac594c.yaml diff --git a/osism/commands/log.py b/osism/commands/log.py index 49cd490e..4ec6d684 100644 --- a/osism/commands/log.py +++ b/osism/commands/log.py @@ -84,7 +84,7 @@ def take_action(self, parsed_args): break result = requests.post( - f"https://{settings.OPENSEARCH_ADDRESS}:{settings.OPENSEARCH_PORT}/_plugins/_sql?format=json", + f"{settings.OPENSEARCH_PROTOCOL}://{settings.OPENSEARCH_ADDRESS}:{settings.OPENSEARCH_PORT}/_plugins/_sql?format=json", data=json.dumps({"query": query}), headers={"content-type": "application/json"}, verify=False, diff --git a/osism/settings.py b/osism/settings.py index e752fd0d..9cae6960 100644 --- a/osism/settings.py +++ b/osism/settings.py @@ -15,6 +15,7 @@ def read_secret(secret_name): OPENSEARCH_ADDRESS = os.getenv("OPENSEARCH_ADDRESS") +OPENSEARCH_PROTOCOL = os.getenv("OPENSEARCH_PROTOCOL", "https") OPENSEARCH_PORT = os.getenv("OPENSEARCH_PORT") REDIS_HOST: str = os.getenv("REDIS_HOST", "redis") diff --git a/releasenotes/notes/opensearch-protocol-c222c86a24ac594c.yaml b/releasenotes/notes/opensearch-protocol-c222c86a24ac594c.yaml new file mode 100644 index 00000000..6c80ac2c --- /dev/null +++ b/releasenotes/notes/opensearch-protocol-c222c86a24ac594c.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + With the `OPENSEARCH_PROTOCOL` environment variable it is now possible + to configure the protocol (`http` or `https`) that should be used by + `osism log opensearch`.