Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions leafmap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3316,19 +3316,23 @@ def get_local_tile_layer(
for key in client_args:
kwargs[key] = client_args[key]

# Make it compatible with binder and JupyterHub
if os.environ.get("JUPYTERHUB_SERVICE_PREFIX") is not None:
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = (
f"{os.environ['JUPYTERHUB_SERVICE_PREFIX'].lstrip('/')}/proxy/{{port}}"
)
# Only override LOCALTILESERVER_CLIENT_PREFIX if it's unset
if os.environ.get("LOCALTILESERVER_CLIENT_PREFIX") is None:
# Make it compatible with binder and JupyterHub
if os.environ.get("JUPYTERHUB_SERVICE_PREFIX") is not None:
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = (
f"{os.environ['JUPYTERHUB_SERVICE_PREFIX'].strip('/')}/proxy/{{port}}"
)

if is_studio_lab():
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = (
f"studiolab/default/jupyter/proxy/{{port}}"
)
elif is_on_aws():
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = "proxy/{port}"
elif "prefix" in kwargs:
if is_studio_lab():
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = (
f"studiolab/default/jupyter/proxy/{{port}}"
)
elif is_on_aws():
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = "proxy/{port}"

# The prefix kwarg has final precedence
if "prefix" in kwargs:
os.environ["LOCALTILESERVER_CLIENT_PREFIX"] = kwargs["prefix"]
kwargs.pop("prefix")

Expand Down
Loading