Put secret file path in definitions

This commit is contained in:
Yarne Coppens 2024-08-02 11:22:08 +02:00
parent 86c3f54d03
commit 8b829c4f7c
2 changed files with 3 additions and 7 deletions

View file

@ -1,3 +1,4 @@
import os import os
ROOT_PATH = project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ROOT_PATH = project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
SECRETS_FILE_PATH = ROOT_PATH + '/secrets/auth.yaml'

View file

@ -7,16 +7,11 @@ from src.config import definitions
username: str = None username: str = None
password: str = None password: str = None
auth_secret_file_location = definitions.ROOT_PATH + '/secrets/auth.yaml'
auth_secret_file_location
def load_username_password_from_secrets(): def load_username_password_from_secrets():
global username global username
global password global password
with open(auth_secret_file_location, 'r') as auth_file: with open(definitions.SECRETS_FILE_PATH, 'r') as auth_file:
auth_object = yaml.safe_load(auth_file) auth_object = yaml.safe_load(auth_file)
username = auth_object['username'] username = auth_object['username']