34 lines
883 B
Python
34 lines
883 B
Python
"""
|
|
Config
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2023 Project Peter Yefi peteryefi@gmail.com
|
|
"""
|
|
import os
|
|
import platform
|
|
from pathlib import Path
|
|
|
|
from hub.persistence.db_control import DBControl
|
|
from hub.persistence.repository import Repository
|
|
|
|
|
|
class Config:
|
|
|
|
def __init__(self):
|
|
dotenv_path = "{}/.env".format(os.path.expanduser('~'))
|
|
if platform.system() == 'Linux':
|
|
dotenv_path = Path('/home/guille/.local/etc/hub/.env').resolve()
|
|
|
|
environment = 'TEST'
|
|
database_name = 'montreal_retrofit_test'
|
|
|
|
self._database = DBControl(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
|
self._repository = Repository(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
|
|
|
@property
|
|
def database(self):
|
|
return self._database
|
|
|
|
@property
|
|
def repository(self):
|
|
return self._repository
|