Open dietervansteenwegen opened 2 years ago
If done, remove credentials options from db module...
load_dotenv returns True, no matter if succesful or not. Parsing the file using configparser and then setting them manually using
import os
# Set variables
os.environ['USERNAME'] = 'user'
# Get variables
user = os.getenv('USERNAME')
BAR = os.environ.get('BAR') # returns None if variable does not exist
Doesn't work as I expected either. Environmental variables are limited in scope to the proces they are created in. Thus, they are only visible from within the Python process they are set from. So this cannot be used inter-process...
Might have to come up with another option or reevaluate how to use this.
Currently credentials are stored in the database. This leaves them open to be viewed by anyone that has access to (backups of) the database. Loading the credentials in to the linux environment variables at boot allows all scripts to access them, without storing anything in the database.
from this blogpost