Some documentation

This commit is contained in:
Felipe M 2020-12-14 23:25:48 +01:00
parent c8c5fefabc
commit 49a9fccbf3
Signed by: fmartingr
GPG key ID: 716BC147715E716F
4 changed files with 70 additions and 24 deletions

View file

@ -11,29 +11,13 @@ from butterrobot.queue import q
from butterrobot.db import ChannelQuery
from butterrobot.config import SECRET_KEY, HOSTNAME
from butterrobot.objects import Message, Channel
from butterrobot.http import ExternalProxyFix
from butterrobot.plugins import get_available_plugins
from butterrobot.platforms import PLATFORMS, get_available_platforms
from butterrobot.platforms.base import Platform
from butterrobot.admin.blueprint import admin as admin_bp
class ExternalProxyFix(object):
"""
Custom proxy helper to get the external hostname from the `X-External-Host` header
used by one of the reverse proxies in front of this in production.
It does nothing if the header is not present.
"""
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
host = environ.get("HTTP_X_EXTERNAL_HOST", "")
if host:
environ["HTTP_HOST"] = host
return self.app(environ, start_response)
loop = asyncio.get_event_loop()
logger = structlog.get_logger(__name__)
app = Flask(__name__)