Skip to content

Commit 5241eb8

Browse files
committed
Cleanup.
No-Issue Signed-off-by: James Tanner <tanner.jc@gmail.com>
1 parent 6f64286 commit 5241eb8

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

galaxy_ng/app/dynaconf_hooks.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -719,29 +719,24 @@ def alter_hostname_settings(
719719
*args,
720720
**kwargs
721721
) -> Any:
722+
"""Use the request headers to dynamically alter the content origin and api hostname.
723+
This is useful in scenarios where the hub is accessible directly and through a
724+
reverse proxy.
725+
"""
722726

723727
ALLOWED_KEYS = ['CONTENT_ORIGIN', 'ANSIBLE_API_HOSTNAME']
724728

725-
# if 'CACHE' in key.upper():
726-
# print(f'PID:{os.getpid()} READY:{apps.ready} KEY:{key} VAL:{value.value}')
727-
728729
if not apps.ready or key.upper() not in DYNAMIC_SETTINGS_SCHEMA:
729730
# If app is starting up or key is not on allowed list bypass and just return the value
730-
if key.upper() in ALLOWED_KEYS:
731-
print(f"SKIPPING {key}")
732731
return value.value
733732

734733
if key.upper() in ALLOWED_KEYS:
735734
req = get_current_request()
736735
if req is not None:
737736
headers = dict(req.headers)
738-
print(f'REQ: {req}')
739-
print(f'REQ.headers: ...')
740-
from pprint import pprint; pprint(headers)
741737
proto = headers.get('X-Forwarded-Proto', 'http')
742738
host = headers.get('Host', 'localhost:5001')
743739
baseurl = proto + '://' + host
744-
print(f'KEY:{key} -> {baseurl}')
745740
return baseurl
746741

747742
return temp_settings.get(key, value.value)

0 commit comments

Comments
 (0)