From be627e792d68d426d58a1b7f8ee4b8886a7ba14c Mon Sep 17 00:00:00 2001 From: ajaywk7 Date: Mon, 29 Jul 2024 15:23:40 +0530 Subject: [PATCH] Changed X_ENV env variable name to X-ENV --- elastalert/config.py | 2 +- elastalert/elastalert.py | 4 ++-- elastalert/util.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/elastalert/config.py b/elastalert/config.py index 9cc2618bc..7a47c9187 100644 --- a/elastalert/config.py +++ b/elastalert/config.py @@ -26,7 +26,7 @@ 'ES_URL_PREFIX': 'es_url_prefix', 'STATSD_INSTANCE_TAG': 'statsd_instance_tag', 'STATSD_HOST': 'statsd_host', - 'X_ENV':'X_ENV'} + 'X-ENV':'X-ENV'} env = Env(ES_USE_SSL=bool) diff --git a/elastalert/elastalert.py b/elastalert/elastalert.py index 5cf6c6210..e1ccc435b 100755 --- a/elastalert/elastalert.py +++ b/elastalert/elastalert.py @@ -705,8 +705,8 @@ def get_ch_data(self, rule, starttime, endtime, agg_key, freshquery,aggregation) } try: headers = {} - if 'X_ENV' in rule: - headers['X-ENV'] = rule['X_ENV'] + if 'X-ENV' in rule: + headers['X-ENV'] = rule['X-ENV'] res = requests.post(self.query_endpoint, json=data, headers=headers) res.raise_for_status() except requests.exceptions.RequestException as e: diff --git a/elastalert/util.py b/elastalert/util.py index dedb8b42a..9ebddaea0 100644 --- a/elastalert/util.py +++ b/elastalert/util.py @@ -420,10 +420,10 @@ def build_adapter_conn_config(conf): elif 'es_bearer' in conf: parsed_conf['es_bearer'] = conf['es_bearer'] - if os.environ.get('X_ENV'): - parsed_conf['headers']['X-ENV'] = os.environ.get('X_ENV') - elif 'X_ENV' in conf: - parsed_conf['headers']['X-ENV'] = os.environ.get('X_ENV') + if os.environ.get('X-ENV'): + parsed_conf['headers']['X-ENV'] = os.environ.get('X-ENV') + elif 'X-ENV' in conf: + parsed_conf['headers']['X-ENV'] = os.environ.get('X-ENV') if 'aws_region' in conf: parsed_conf['aws_region'] = conf['aws_region']