Skip to content

Commit

Permalink
parameterize hub host
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Jan 6, 2024
1 parent e502ded commit 934f6a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions jhub_apps/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ class JAppsConfig(SingletonConfigurable):
"jupyterhub_config.py",
help="Path to JupyterHub config file.",
).tag(config=True)

hub_host = Unicode(
"127.0.0.1",
help="Hub Host name, in k8s environment it would be the container name, e.g. 'hub'",
).tag(config=True)
5 changes: 4 additions & 1 deletion jhub_apps/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def install_jhub_apps(c, spawner_to_subclass):
if not isinstance(c.JAppsConfig.app_icon, str):
c.JAppsConfig.app_icon = JAppsConfig.app_icon.default_value

if not isinstance(c.JAppsConfig.hub_host, str):
c.JAppsConfig.hub_host = JAppsConfig.hub_host.default_value

if not isinstance(c.JAppsConfig.jupyterhub_config_path, str):
c.JAppsConfig.jupyterhub_config_path = (
JAppsConfig.jupyterhub_config_path.default_value
Expand All @@ -45,7 +48,7 @@ def install_jhub_apps(c, spawner_to_subclass):
[
{
"name": fast_api_service_name,
"url": "http://127.0.0.1:10202",
"url": f"http://{c.JAppsConfig.hub_host}:10202",
"command": [
c.JAppsConfig.python_exec,
"-m",
Expand Down

0 comments on commit 934f6a1

Please sign in to comment.