from werkzeug.middleware.proxy_fix import ProxyFix
from mirrormanager2.app import create_app
from flask_session import Session
from cachelib.file import FileSystemCache
import os

application = create_app()
application.debug = os.environ.get("MM2_DEBUG", False)
application.config['SESSION_TYPE'] = "cachelib"
application.config['SESSION_CACHELIB'] = FileSystemCache(cache_dir='/tmp/sessions', threshold=500)
Session(application)
application.wsgi_app = ProxyFix(application.wsgi_app, x_proto=1, x_host=1)

