47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
""" Server-package
|
|
|
|
Initialize app, cors, database and bcrypt (for passwordhashing) and added it to the application.
|
|
Initialize also a singelton for the AccesTokenControler and start the Thread.
|
|
|
|
"""
|
|
from .logger import getLogger
|
|
from geruecht.controller import dbConfig
|
|
from flask_mysqldb import MySQL
|
|
from flask_ldapconn import LDAPConn
|
|
|
|
LOGGER = getLogger(__name__)
|
|
LOGGER.info("Initialize App")
|
|
|
|
from flask import Flask
|
|
from flask_cors import CORS
|
|
|
|
LOGGER.info("Build APP")
|
|
app = Flask(__name__)
|
|
CORS(app)
|
|
app.config['SECRET_KEY'] = '0a657b97ef546da90b2db91862ad4e29'
|
|
app.config['MYSQL_HOST'] = dbConfig['URL']
|
|
app.config['MYSQL_USER'] = dbConfig['user']
|
|
app.config['MYSQL_PASSWORD'] = dbConfig['passwd']
|
|
app.config['MYSQL_DB'] = dbConfig['database']
|
|
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
|
|
app.config['LDAP_SERVER'] = '192.168.5.128'
|
|
app.config['LDAP_PORT'] = 389
|
|
app.config['LDAP_BINDDN'] = 'dc=ldap,dc=example,dc=local'
|
|
app.config['LDAP_USE_TLS'] = False
|
|
app.config['FORCE_ATTRIBUTE_VALUE_AS_LIST'] = True
|
|
|
|
ldap = LDAPConn(app)
|
|
db = MySQL(app)
|
|
|
|
from geruecht import routes
|
|
from geruecht.baruser.routes import baruser
|
|
from geruecht.finanzer.routes import finanzer
|
|
from geruecht.user.routes import user
|
|
from geruecht.vorstand.routes import vorstand
|
|
|
|
LOGGER.info("Registrate bluebrints")
|
|
app.register_blueprint(baruser)
|
|
app.register_blueprint(finanzer)
|
|
app.register_blueprint(user)
|
|
app.register_blueprint(vorstand)
|