Skip to content

Commit

Permalink
fix: unset env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
LightDestory committed Nov 19, 2024
1 parent 923e34c commit e850865
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions modules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down
4 changes: 2 additions & 2 deletions tg_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit e850865

Please sign in to comment.