2019-04-17 12:46:46 +00:00
|
|
|
""" 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.
|
|
|
|
|
|
|
|
"""
|
2019-12-28 20:52:49 +00:00
|
|
|
from .logger import getLogger
|
2020-02-26 22:03:02 +00:00
|
|
|
from geruecht.controller import dbConfig, ldapConfig
|
2020-01-19 20:32:58 +00:00
|
|
|
from flask_mysqldb import MySQL
|
2020-01-21 05:54:35 +00:00
|
|
|
from flask_ldapconn import LDAPConn
|
2019-05-02 23:40:13 +00:00
|
|
|
|
|
|
|
LOGGER = getLogger(__name__)
|
|
|
|
LOGGER.info("Initialize App")
|
2019-04-17 12:46:46 +00:00
|
|
|
|
2019-04-11 21:56:55 +00:00
|
|
|
from flask import Flask
|
2019-04-12 12:51:37 +00:00
|
|
|
from flask_cors import CORS
|
2019-01-13 19:07:46 +00:00
|
|
|
|
2019-05-02 23:40:13 +00:00
|
|
|
LOGGER.info("Build APP")
|
2019-01-13 19:07:46 +00:00
|
|
|
app = Flask(__name__)
|
2019-04-12 12:51:37 +00:00
|
|
|
CORS(app)
|
2020-01-19 08:07:45 +00:00
|
|
|
app.config['SECRET_KEY'] = '0a657b97ef546da90b2db91862ad4e29'
|
2020-01-19 20:32:58 +00:00
|
|
|
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'
|
2020-02-26 22:03:02 +00:00
|
|
|
app.config['LDAP_SERVER'] = ldapConfig['URL']
|
|
|
|
app.config['LDAP_PORT'] = ldapConfig['port']
|
|
|
|
app.config['LDAP_BINDDN'] = ldapConfig['dn']
|
2020-01-21 05:54:35 +00:00
|
|
|
app.config['LDAP_USE_TLS'] = False
|
|
|
|
app.config['FORCE_ATTRIBUTE_VALUE_AS_LIST'] = True
|
|
|
|
|
|
|
|
ldap = LDAPConn(app)
|
2020-01-19 20:32:58 +00:00
|
|
|
db = MySQL(app)
|
2019-01-13 23:25:25 +00:00
|
|
|
|
2019-04-11 21:56:55 +00:00
|
|
|
from geruecht import routes
|
2019-12-22 21:27:39 +00:00
|
|
|
from geruecht.baruser.routes import baruser
|
2019-12-19 17:26:41 +00:00
|
|
|
from geruecht.finanzer.routes import finanzer
|
2020-01-17 00:05:58 +00:00
|
|
|
from geruecht.user.routes import user
|
2020-01-18 22:31:49 +00:00
|
|
|
from geruecht.vorstand.routes import vorstand
|
2020-03-01 18:20:47 +00:00
|
|
|
from geruecht.gastro.routes import gastrouser
|
2019-05-01 20:43:28 +00:00
|
|
|
|
2019-12-19 17:26:41 +00:00
|
|
|
LOGGER.info("Registrate bluebrints")
|
2019-12-22 21:27:39 +00:00
|
|
|
app.register_blueprint(baruser)
|
2019-12-19 17:26:41 +00:00
|
|
|
app.register_blueprint(finanzer)
|
2020-01-17 00:05:58 +00:00
|
|
|
app.register_blueprint(user)
|
2020-01-18 22:31:49 +00:00
|
|
|
app.register_blueprint(vorstand)
|
2020-03-01 18:20:47 +00:00
|
|
|
app.register_blueprint(gastrouser)
|