Interacting With Environment Variables in Python for App Configuration and Secrets.
Creating .env file
Create a .env
file with your environment variables in the following format:
Reading .env file
Install python-dotenv to read the .env file:
Now you can read the .env
file as follows:
FAQ
How get GitHub secrets?
Add a new secret, go to your GitHub repository > Settings > Secrets > New Repository Secret
.
Once added, you can then map them as environment variables in your GitHub actions workflow.
References