From abd3bc13d2d7c9100a366c0862b1429981d5c584 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 11 Oct 2018 16:54:25 +0200 Subject: [PATCH] add entrypoint for proxy implementations --- jupyterhub/app.py | 15 ++++++++++++--- setup.py | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/jupyterhub/app.py b/jupyterhub/app.py index 0348c065..4e91d87a 100644 --- a/jupyterhub/app.py +++ b/jupyterhub/app.py @@ -421,9 +421,18 @@ class JupyterHub(Application): help="Supply extra arguments that will be passed to Jinja environment." ).tag(config=True) - proxy_class = Type(ConfigurableHTTPProxy, Proxy, - help="""Select the Proxy API implementation.""" - ).tag(config=True) + proxy_class = EntryPointType( + default_value=ConfigurableHTTPProxy, + klass=Proxy, + help="""The class to use for configuring the JupyterHub proxy. + + Should be a subclass of :class:`jupyterhub.proxy.Proxy`. + + .. versionchanged:: 1.0 + proxies may be registered via entry points, + e.g. `c.JupyterHub.proxy_class = 'traefik'` + """ + ).tag(config=True) proxy_cmd = Command([], config=True, help="DEPRECATED since version 0.8. Use ConfigurableHTTPProxy.command", diff --git a/setup.py b/setup.py index 0f7a9c15..b085bce5 100755 --- a/setup.py +++ b/setup.py @@ -112,6 +112,10 @@ setup_args = dict( 'pam = jupyterhub.auth:PAMAuthenticator', 'dummy = jupyterhub.auth:DummyAuthenticator', ], + 'jupyterhub.proxies': [ + 'default = jupyterhub.proxy:ConfigurableHTTPProxy', + 'configurable-http-proxy = jupyterhub.proxy:ConfigurableHTTPProxy', + ], 'jupyterhub.spawners': [ 'default = jupyterhub.spawner:LocalProcessSpawner', 'localprocess = jupyterhub.spawner:LocalProcessSpawner',