diff --git a/.env.example b/.env.example index 431681b..5522766 100644 --- a/.env.example +++ b/.env.example @@ -6,4 +6,5 @@ DISCORD_WEBHOOK=https://webhookaddress MAIN_DOMAIN=http://baseOfDomainForbackupsPropagationViaWebhook DISCORD_BACKUPNAME=ServerName DISCORD_ENABLED=1 -BACKUPS_KEEP_DAYS=4 \ No newline at end of file +BACKUPS_KEEP_DAYS=4 +TRY_NUMBER=5 \ No newline at end of file diff --git a/src/conf.py b/src/conf.py index 6cbf3ea..a7b0e51 100644 --- a/src/conf.py +++ b/src/conf.py @@ -12,6 +12,7 @@ class Config(BaseSettings): discord_enabled: int discord_backupname: str backups_keep_days: int + try_number: int cfg = Config() diff --git a/src/main.py b/src/main.py index c0b983b..abaea61 100644 --- a/src/main.py +++ b/src/main.py @@ -2,8 +2,8 @@ from conf import get_config import pterodactylReader, fileDownloader, datetime, discordPoster, time, oldRemover def run(run_number: int): + conf = get_config() try: - conf = get_config() api_client = pterodactylReader.init_client(config=conf) today_date = datetime.datetime.now() @@ -26,7 +26,7 @@ def run(run_number: int): except Exception as e: print(f"Error on try #{run_number}: {e}") - if run_number < 5: + if run_number < conf.try_number: run(run_number=(run_number + 1))