diff --git a/Dockerfile b/Dockerfile index 332fe5d..e2b1c40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ FROM python:3.10.9-alpine -ENV TG_SESSION="" +ENV TG_SESSION="tg_downloader" ENV TG_API_ID="" ENV TG_API_HASH="" ENV TG_BOT_TOKEN="" ENV TG_DOWNLOAD_PATH="" -ENV TG_MAX_PARALLEL="" -ENV TG_DL_TIMEOUT="" +ENV TG_MAX_PARALLEL=4 +ENV TG_DL_TIMEOUT=5400 ENV TG_AUTHORIZED_USER_ID="" WORKDIR /app diff --git a/modules/helpers.py b/modules/helpers.py index 4a78276..0c86f0b 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -31,9 +31,9 @@ def get_env(name: str, message: str, is_int: bool = False) -> int | str: time.sleep(1) -def get_config_from_user() -> ConfigFile: +def get_config_from_user_or_env() -> ConfigFile: """ - This function ask the user to enter the needed information + This function check for env vars or ask the user to enter the needed information :return: A ConfigFile instance """ logging.info("Retrieving configuration from user/env...") diff --git a/tg_downloader.py b/tg_downloader.py index 36fed12..ea900d2 100644 --- a/tg_downloader.py +++ b/tg_downloader.py @@ -16,7 +16,7 @@ from pyrogram.enums import ParseMode, MessageMediaType from modules.ConfigManager import ConfigManager -from modules.helpers import get_config_from_user +from modules.helpers import get_config_from_user_or_env from modules.models.ConfigFile import ConfigFile GITHUB_LINK: str = "https://github.com/LightDestory/TG_MediaDownloader" @@ -44,7 +44,7 @@ def init() -> Client | None: """ config: ConfigFile if not config_manager.load_config_from_file(): - config = get_config_from_user() + config = get_config_from_user_or_env() if config_manager.validate_config(config): config_manager.load_config(config) if not config_manager.save_config_to_file():