Move to pydantic settings paradigm

This commit is contained in:
Roman Krček
2024-10-13 19:47:06 +02:00
parent c68d3d8722
commit d236f88b64
4 changed files with 68 additions and 19 deletions

View 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()