mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Allow to listen on a specific address via TLJH config
This commit is contained in:
@@ -244,10 +244,15 @@ def check_hub_ready():
|
||||
|
||||
base_url = load_config()["base_url"]
|
||||
base_url = base_url[:-1] if base_url[-1] == "/" else base_url
|
||||
http_address = load_config()["http"]["address"]
|
||||
http_port = load_config()["http"]["port"]
|
||||
# The default config is an empty address, so it binds on all interfaces.
|
||||
# Test the connectivity on the local address.
|
||||
if http_address == '':
|
||||
http_address = '127.0.0.1'
|
||||
try:
|
||||
r = requests.get(
|
||||
"http://127.0.0.1:%d%s/hub/api" % (http_port, base_url), verify=False
|
||||
"http://%s:%d%s/hub/api" % (http_address, http_port, base_url), verify=False
|
||||
)
|
||||
if r.status_code != 200:
|
||||
print(f"Hub not ready: (HTTP status {r.status_code})")
|
||||
|
||||
Reference in New Issue
Block a user