Open Sheihesinusslon opened 11 months ago
TELEGRAM_BOT_TOKEN: str = None should be TELEGRAM_BOT_TOKEN: Optional[str] = None
I actually want the application to crash if the token or any other env var is not set or not read, because that means there is something wrong with the variables and their loading, which means other critical variables like the database host may not be set either and you have to go and look in that place.
https://github.com/r-ss/foldwrap_backend/blob/5c4437e439ad34e534e4b05bd16d9c2818b86d4e/src/config.py#L11
PRODUCTION False or True should rather be taken from env variables. Also, a better idea is to have ENV constant variable reading DEV or PROD from env variables
https://github.com/r-ss/foldwrap_backend/blob/5c4437e439ad34e534e4b05bd16d9c2818b86d4e/src/config.py#L27
Print statements should be avoided. If you really need to use this info, use log
https://github.com/r-ss/foldwrap_backend/blob/5c4437e439ad34e534e4b05bd16d9c2818b86d4e/src/config.py#L79-L83
While you work on the project just by ourself, it can be fine but try not to push commented code in the repo at all. Usually, it´s confusing why a developer decided to keep it.
Typing: TELEGRAM_BOT_TOKEN: str = None should be TELEGRAM_BOT_TOKEN: Optional[str] = None or pydantic maybe even allows just to keep it as TELEGRAM_BOT_TOKEN: Optional[str] and it will be initialized with None value
TIP