mirrormanager-rocky/run.py
Neil Hanlon 363191a9b5
update theme for latest mirrormanager
various fixes and updates for running in ECS, too
2024-12-20 12:30:23 -05:00

22 lines
822 B
Python

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
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}"
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)