2024-08-28 12:51:25 +00:00
|
|
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
|
|
from mirrormanager2.app import create_app
|
2024-08-30 19:34:13 +00:00
|
|
|
from flask_session import Session
|
|
|
|
from cachelib.file import FileSystemCache
|
|
|
|
import os
|
|
|
|
|
2024-12-20 17:30:23 +00:00
|
|
|
password = os.environ.get('MM2_DATABASE_PASSWORD')
|
|
|
|
if password:
|
|
|
|
user = os.environ.get('DB_USER')
|
|
|
|
host = os.environ.get('DB_HOST')
|
|
|
|
port = os.environ.get('DB_PORT')
|
|
|
|
name = os.environ.get('DB_NAME')
|
|
|
|
os.environ["MM2_SQLALCHEMY_DATABASE_URI"] = f"postgresql://{user}:{password}@{host}:{port}/{name}"
|
|
|
|
|
2024-08-28 12:51:25 +00:00
|
|
|
application = create_app()
|
2024-08-30 19:34:13 +00:00
|
|
|
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)
|
2024-08-28 12:51:25 +00:00
|
|
|
application.wsgi_app = ProxyFix(application.wsgi_app, x_proto=1, x_host=1)
|
|
|
|
|