diff --git a/docker-compose.yaml b/docker-compose.yaml index 20fa721..d2c55e8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,6 +10,7 @@ services: SETTINGS_FILE_FOR_DYNACONF: "/opt/settings.toml" VERBOSE: "True" ALERTING: "True" + ENVIRONMENT: "Dev" # CHANEL: "TODO" networks: - chief_intelligence_officer diff --git a/src/main.py b/src/main.py index 3b2eb02..e7d2be3 100644 --- a/src/main.py +++ b/src/main.py @@ -31,6 +31,13 @@ except KeyError as key_err: logging.warning(f"Key Error - {key_err}") +try: + ENVIRONMENT = os.getenv("ENVIRONMENT") + if ENVIRONMENT: + logger.info(f"Environment is set to {ENVIRONMENT} !") +except KeyError as key_err: + logging.warning(f"Key Error - {key_err}") + def load_config(host_type: str) -> list: """ diff --git a/src/telegram_sender.py b/src/telegram_sender.py index 434eccb..288761f 100644 --- a/src/telegram_sender.py +++ b/src/telegram_sender.py @@ -34,9 +34,10 @@ logging.warning(f"Key Error - {key_err}") -def send_alert_to_telegram(message): +def send_alert_to_telegram(message, environment: str): """ Send messages alerts to telegram + :param environment: :param message: :return: """ @@ -45,7 +46,7 @@ def send_alert_to_telegram(message): API_URL, json={ "chat_id": CHAT_ID, - "text": f"{message}", + "text": f"Environment: {environment} \n {message}", }, ) if response.status_code == 200: