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()
|
2020-01-05 13:15:02 +00:00
|
|
|
mailConfig = config.getMail()
|
2019-12-30 08:22:43 +00:00
|
|
|
|
|
|
|
db = DatabaseController(dbConfig['URL'], dbConfig['user'], dbConfig['passwd'], dbConfig['database'])
|
|
|
|
ldapController = LDAPController(ldapConfig['URL'], ldapConfig['dn'])
|
2020-01-18 22:31:49 +00:00
|
|
|
|
2020-01-05 13:15:02 +00:00
|
|
|
from . emailController import EmailController
|
|
|
|
emailController = EmailController(mailConfig['URL'], mailConfig['user'], mailConfig['passwd'], mailConfig['port'], mailConfig['email'])
|
2019-12-28 20:52:49 +00:00
|
|
|
from . userController import UserController
|
2020-01-18 22:31:49 +00:00
|
|
|
def getUserController():
|
|
|
|
if userController is not None:
|
|
|
|
return userController
|
|
|
|
else:
|
|
|
|
return UserController()
|
|
|
|
userController = UserController()
|
|
|
|
accesTokenController = AccesTokenController(accConfig)
|