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`.