37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
"""
|
|
Config
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2023 Project Peter Yefi peteryefi@gmail.com
|
|
"""
|
|
from hub.exports.db_factory import DBFactory as CityExportFactory
|
|
from hub.imports.db_factory import DBFactory
|
|
import os
|
|
from hub.imports.user_factory import UserFactory
|
|
from hub.exports.user_factory import UserFactory as ExUserFactory
|
|
|
|
|
|
class Config:
|
|
|
|
def __init__(self):
|
|
db_name = None
|
|
app_env = None
|
|
if os.getenv("FLASK_DEBUG") == 'production':
|
|
db_name = 'hub_prod'
|
|
app_env = 'PROD'
|
|
elif os.getenv("FLASK_DEBUG") == 'testing':
|
|
db_name = 'test_db'
|
|
app_env = 'TEST'
|
|
|
|
self.export_db_factory = CityExportFactory(db_name=db_name, app_env=app_env,
|
|
dotenv_path="{}/.env".format(os.path.expanduser('~')))
|
|
self.import_db_factory = DBFactory(db_name=db_name, app_env=app_env,
|
|
dotenv_path="{}/.env".format(os.path.expanduser('~')))
|
|
self.user_factory = UserFactory(db_name=db_name, app_env=app_env,
|
|
dotenv_path="{}/.env".format(os.path.expanduser('~')))
|
|
|
|
self.ex_user_factory = ExUserFactory(db_name=db_name, app_env=app_env,
|
|
dotenv_path="{}/.env".format(os.path.expanduser('~')))
|
|
|
|
def get_city(self, city_id):
|
|
return self.export_db_factory.get_city(city_id)
|