diff --git a/alive.py b/alive.py index 59b5b6a..bf69297 100644 --- a/alive.py +++ b/alive.py @@ -5,24 +5,23 @@ import time import requests import os +import subprocess from dotenv import load_dotenv +CONFIG_FILE_URL = os.environ.get('CONFIG_FILE_URL', None) +if CONFIG_FILE_URL is not None: + out = subprocess.run(["wget", "-q", "-O", "config.env", CONFIG_FILE_URL]) + load_dotenv('config.env') -try: - BASE_URL = os.environ.get('BASE_URL_OF_BOT', None) - if len(BASE_URL) == 0: - BASE_URL = None -except KeyError: +BASE_URL = os.environ.get('BASE_URL_OF_BOT', None) +if len(BASE_URL) == 0: BASE_URL = None -try: - IS_VPS = os.environ.get('IS_VPS', 'False') - if IS_VPS.lower() == 'true': - IS_VPS = True - else: - IS_VPS = False -except KeyError: +IS_VPS = os.environ.get('IS_VPS', 'False') +if IS_VPS.lower() == 'true': + IS_VPS = True +else: IS_VPS = False if not IS_VPS and BASE_URL is not None: diff --git a/bot/__init__.py b/bot/__init__.py index 6aeb012..d2a0901 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -33,12 +33,6 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s LOGGER = logging.getLogger(__name__) -CONFIG_FILE_URL = os.environ.get('CONFIG_FILE_URL', None) -if CONFIG_FILE_URL is not None: - out = subprocess.run(["wget", "-q", "-O", "config.env", CONFIG_FILE_URL]) - if out.returncode != 0: - logging.error(out) - load_dotenv('config.env') Interval = []