2019-12-28 20:52:49 +00:00
|
|
|
from geruecht.logger import getLogger
|
2019-12-30 08:22:43 +00:00
|
|
|
from geruecht.configparser import ConifgParser
|
|
|
|
import os
|
|
|
|
|
|
|
|
print(os.getcwd())
|
|
|
|
|
|
|
|
config = ConifgParser('geruecht/config.yml')
|
2019-05-02 23:40:13 +00:00
|
|
|
|
|
|
|
LOGGER = getLogger(__name__)
|
2019-12-28 20:52:49 +00:00
|
|
|
|
|
|
|
class Singleton(type):
|
|
|
|
_instances = {}
|
|
|
|
def __call__(cls, *args, **kwargs):
|
|
|
|
if cls not in cls._instances:
|
|
|
|
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
|
|
|
|
return cls._instances[cls]
|
|
|
|
|
|
|
|
from .databaseController import DatabaseController
|
|
|
|
def getDatabesController():
|
|
|
|
if db is not None:
|
|
|
|
return db
|
|
|
|
else:
|
2019-12-30 08:22:43 +00:00
|
|
|
return DatabaseController(dbConfig['URL'], dbConfig['user'], dbConfig['passwd'], dbConfig['database'])
|
2019-12-28 20:52:49 +00:00
|
|
|
from .ldapController import LDAPController
|
|
|
|
def getLDAPController():
|
|
|
|
if ldapController is not None:
|
|
|
|
return ldapController
|
|
|
|
else:
|
2019-12-30 08:22:43 +00:00
|
|
|
return LDAPController(ldapConfig['URL'], ldapConfig['dn'])
|
2019-12-28 20:52:49 +00:00
|
|
|
from .accesTokenController import AccesTokenController
|
|
|
|
|
2019-12-30 08:22:43 +00:00
|
|
|
dbConfig = config.getDatabase()
|
|
|
|
ldapConfig = config.getLDAP()
|
|
|
|
accConfig = config.getAccessToken()
|
|
|
|
|
|
|
|
db = DatabaseController(dbConfig['URL'], dbConfig['user'], dbConfig['passwd'], dbConfig['database'])
|
|
|
|
ldapController = LDAPController(ldapConfig['URL'], ldapConfig['dn'])
|
|
|
|
accesTokenController = AccesTokenController(accConfig)
|
2019-12-28 20:52:49 +00:00
|
|
|
from . userController import UserController
|
|
|
|
userController = UserController()
|