Move to pydantic settings paradigm
This commit is contained in:
53
telegram_downloader_bot/settings.py
Normal file
53
telegram_downloader_bot/settings.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import os
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""
|
||||
Settings class that defines configuration variables for the application.
|
||||
|
||||
Attributes:
|
||||
----------
|
||||
app_env : str
|
||||
Specifies the environment in which the application is running.
|
||||
Default is 'DEV'. Possible values could include 'DEV', 'PROD'
|
||||
|
||||
workers : int
|
||||
Defines the number of workers to be used in the application.
|
||||
Default is 1.
|
||||
|
||||
api_id : int
|
||||
Represents the API ID from my.telegram.org
|
||||
|
||||
api_hash : str
|
||||
The hash key corresponding to your API Hash from my.telegram.org
|
||||
|
||||
bot_token : str
|
||||
The token from BotFather.
|
||||
|
||||
storage : os.path
|
||||
Specifies the path where the application stores persistent data.
|
||||
|
||||
allowed_ids : str
|
||||
A list or comma-separated string of IDs that are allowed access
|
||||
to the bot or application.
|
||||
|
||||
Config:
|
||||
-------
|
||||
env_file : str
|
||||
Specifies the environment file to load the environment variables from.
|
||||
Default is ".env".
|
||||
"""
|
||||
app_env: str = "DEV"
|
||||
workers: int = 1
|
||||
api_id: int
|
||||
api_hash: str
|
||||
bot_token: str
|
||||
storage: os.path
|
||||
allowed_ids: str
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user