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

Find a better way to store the password in package_search.py #198

Closed
pleia2 opened this issue May 20, 2024 · 5 comments · Fixed by #202
Closed

Find a better way to store the password in package_search.py #198

pleia2 opened this issue May 20, 2024 · 5 comments · Fixed by #202

Comments

@pleia2
Copy link
Contributor

pleia2 commented May 20, 2024

In production, it's recommended to use something like our https://github.com/openmainframeproject/software-discovery-tool-deploy system which updates the production tool with every commit so that the tool automatically stays up to date.

Today it doesn't quite work because changes have to be made to src/classes/package_search.py to add the read-only MariaDB password for the web UI to query. This results in an error when running git pull to keep the rest of the code up to date.

"Edit line 14 of a script" isn't the best way to store secrets anyway 😄 so let's come up with a better way of storing this password that doesn't require editing this file. If the file stays pristine, we won't have the git pull error!

@duckling69
Copy link

Hey @pleia2 I'd like to work on this issue

@pleia2
Copy link
Contributor Author

pleia2 commented May 20, 2024

@duckling69 Great! Let's discuss here a proposal for how you'd like to solve this, what are your thoughts?

@hbarsaiyan
Copy link
Contributor

We can create a .env file in the root directory and add it to .gitignore. We use python-dotenv to read the password as PASSWORD = os.environ.get('DB_PASSWORD').

@pleia2
Copy link
Contributor Author

pleia2 commented May 21, 2024

We can create a .env file in the root directory and add it to .gitignore. We use python-dotenv to read the password as PASSWORD = os.environ.get('DB_PASSWORD').

Good idea! Let's move forward with this solution 👍

@duckling69
Copy link

I was thinking of using something like TOML file to store config variables as it has structured data storage, data types and validation and is less likely to throw an error in future // @pleia2

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

Successfully merging a pull request may close this issue.

3 participants