Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to organize the variables #39

Open
CaetanoGS opened this issue Feb 8, 2024 · 0 comments
Open

Suggestion to organize the variables #39

CaetanoGS opened this issue Feb 8, 2024 · 0 comments

Comments

@CaetanoGS
Copy link

CaetanoGS commented Feb 8, 2024

Here you have Global variables directly on the class file, I would suggest to include it as global variables in your container, and extract them using something like https://pypi.org/project/python-dotenv/

PATH_TO_KEYS = "/app/spotiplot.env"
DEBUG_STATE = False
LOOP_SLEEP = 3

Regarding the DB, you can do the same that you did here db_pass = os.getenv("MYSQL_PASSWORD") for all of the variables, then you just need to configure your container without changing code. It makes easier to deploy and maintain the application.

db_config = {
"user": "os.getenv("MYSQL_USER")",
"password": db_pass,
"host": "os.getenv("MYSQL_HOST")",
"port": os.getenv("MYSQL_PORT"),
"database": "os.getenv("MYSQL_DATABASE")",
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant