2023-01-17 19:00:22 -05:00
|
|
|
"""
|
|
|
|
Config
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2023 Project Peter Yefi peteryefi@gmail.com
|
|
|
|
"""
|
2023-02-24 16:57:51 -05:00
|
|
|
import os
|
2023-03-10 10:18:27 -05:00
|
|
|
import platform
|
|
|
|
from pathlib import Path
|
2023-02-21 10:47:17 -05:00
|
|
|
|
2023-07-20 20:15:24 -04:00
|
|
|
from hub.persistence.db_control import DBControl
|
2023-07-28 08:26:02 -04:00
|
|
|
from hub.persistence.repository import Repository
|
2023-07-31 14:31:50 -04:00
|
|
|
from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCatalogFactory
|
2023-01-17 19:00:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
|
|
|
|
def __init__(self):
|
2023-03-10 12:45:11 -05:00
|
|
|
dotenv_path = "{}/.env".format(os.path.expanduser('~'))
|
2023-02-24 16:57:51 -05:00
|
|
|
if platform.system() == 'Linux':
|
2023-07-20 20:15:24 -04:00
|
|
|
dotenv_path = Path('/home/guille/.local/etc/hub/.env').resolve()
|
2023-02-24 16:57:51 -05:00
|
|
|
|
2023-02-21 10:47:17 -05:00
|
|
|
environment = 'TEST'
|
2023-07-21 16:59:56 -04:00
|
|
|
database_name = 'montreal_retrofit_test'
|
2023-02-20 22:10:09 -05:00
|
|
|
|
2023-07-20 20:15:24 -04:00
|
|
|
self._database = DBControl(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
2023-07-28 08:26:02 -04:00
|
|
|
self._repository = Repository(db_name=database_name, app_env=environment, dotenv_path=dotenv_path)
|
2023-07-31 14:31:50 -04:00
|
|
|
self._energy_systems_catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
|
2023-07-20 20:15:24 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def database(self):
|
|
|
|
return self._database
|
2023-07-28 08:26:02 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def repository(self):
|
|
|
|
return self._repository
|
2023-07-31 14:31:50 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def energy_systems_catalog(self):
|
|
|
|
return self._energy_systems_catalog
|