Closed categulario closed 3 years ago
IMHO: I don't necessarily think that it "complicates bot setup", because that's how Docker/Container work. You have your application in a container, and you persist data using volumes and environment variables (while env labels/secrets are more used for defining settings/options, like database connections or so). If someone isn't able able to spin up the bot the intended way using docker, reading the docker documentation or the principle about containers is recommended anyway.
Thanks @categulario for the PR!
Then, adding a short text description and pointing with links into Docker and Virtual Environment documentations in Readme file should be enough...
However, @categulario and I have some private conversation and we both agree that maybe the first step should be make a separate configuration file (settings.py) passed to Bot launch, it is a better approach to isolate Bot config from the Bot code and also maintain simplicity in setup while avoid requesting the users to know/learn about other technologies like venv, Docker, etc.
With this approach, Bot launch will be something like:
python3 join_captcha_bot.py -c settings.py
After that, then we can also accept environment variables to bring flexibility of use to both, simple users and advanced-users.
Settings file and Environment Variables support added in this commit.
Closing this PR.
While I was trying to setup an instance of this bot I realized that I had to modify a file in the git tree (
constants.py
). That means that there's no easy way to update the bot by just pulling new code, due to the working directory not being clean.Therefore I propose this change, that allows configuration to be read from environment variables so that there's no need to modify a file in the working tree.
I would even go further by doing this:
instead of having a dictionary containing the possible setttings I would put them as top-level variables that can be imported individually:
that makes the
constants.py
a little bit cleaner with the only cost of having to import all the config variables injoin_captcha_bot.py
, which is not that bad because it allows for linters do detect unused variables or misspellings.