Added an authentication manager for handling credentials

This commit is contained in:
Yarne Coppens 2024-07-31 15:15:32 +02:00
parent ac4a90edd1
commit 944ba9791b

25
auth_manager.py Normal file
View file

@ -0,0 +1,25 @@
#Can only be imported on main.py
import yaml
username: str = None
password: str = None
auth_secret_file_location = './secrets/auth.yaml'
def load_username_password_from_secrets():
global username
global password
with open(auth_secret_file_location, 'r') as auth_file:
auth_object = yaml.safe_load(auth_file)
username = auth_object['username']
password = auth_object['password']
def get_username_password():
return username, password
load_username_password_from_secrets()