Allowing full host override (#143)
This commit is contained in:
parent
89a90f4924
commit
40df900dc7
2 changed files with 11 additions and 2 deletions
|
@ -98,6 +98,8 @@ need to change this.
|
|||
|
||||
``REDIS_PREFIX``: (optional, defaults to ``"snappass"``) prefix used on redis keys to prevent collisions with other potential clients
|
||||
|
||||
``HOST_OVERRIDE``: (optional) Used to override the base URL if the app is unaware. Useful when running behind reverse proxies like an identity-aware SSO. Example: ``sub.domain.com``
|
||||
|
||||
Docker
|
||||
------
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ from distutils.util import strtobool
|
|||
|
||||
NO_SSL = bool(strtobool(os.environ.get('NO_SSL', 'False')))
|
||||
URL_PREFIX = os.environ.get('URL_PREFIX', None)
|
||||
HOST_OVERRIDE = os.environ.get('HOST_OVERRIDE', None)
|
||||
TOKEN_SEPARATOR = '~'
|
||||
|
||||
|
||||
|
@ -164,7 +165,13 @@ def handle_password():
|
|||
token = set_password(password, ttl)
|
||||
|
||||
if NO_SSL:
|
||||
if HOST_OVERRIDE:
|
||||
base_url = f'http://{HOST_OVERRIDE}/'
|
||||
else:
|
||||
base_url = request.url_root
|
||||
else:
|
||||
if HOST_OVERRIDE:
|
||||
base_url = f'https://{HOST_OVERRIDE}/'
|
||||
else:
|
||||
base_url = request.url_root.replace("http://", "https://")
|
||||
if URL_PREFIX:
|
||||
|
|
Loading…
Reference in a new issue