Skip to content

c.GitLabConfig.url ignored when using JupyerHub

Hi Benjamin,

thank you for the great extension. It allows us to include a useful collection of notebooks from tutorials and certain user groups in the sidebar of our central JupyterLab.

But I had to patch the extension to ensure beyond the normal configuration files, that our internal GitLab server is used, when JupyterLab is started through JupyterHub. Without JupyterHub the extension works as expected with the following configuration:

drive.json:

<....>
   "properties": {
     "baseUrl": {
       "type": "string",
       "title": "JSC GitLab Base URL",
       "default": "https://gitlab.version.fz-juelich.de"
     },
<....>

jupyter_notebook_config.py:
<....>
    c.GitLabConfig.access_token = "xxxxxxxxxxxxxx"
    c.GitLabConfig.allow_client_side_access_token = False 
    c.GitLabConfig.url = "https://gitlab.version.fz-juelich.de"
    c.GitLabConfig.validate_cert = False
<....>

But when using JupyerLab through JupyterHub the extension falls back to https://gitlab.com ignoring the configured url. By changing the fallback to https://gitlab.version.fz-juelich.de in the source it works fine for us. Of course this is not a general solution ....

--- jupyterlab-gitlab-0.3.0.orig/jupyterlab_gitlab.py   2019-11-04 16:13:56.725121377 +0100
+++ jupyterlab-gitlab-0.3.0/jupyterlab_gitlab.py        2019-11-04 16:11:25.238119700 +0100
@@ -39,7 +39,7 @@
         ),
     )
     url = Unicode(
-        "https://gitlab.com", config=True, help="The url for the GitLab instance."
+        "https://gitlab.version.fz-juelich.de", config=True, help="The url for the GitLab instance."
     )
     access_token = Unicode(
         "", config=True, help=("A personal access token for GitLab.")
--- jupyterlab-gitlab-0.3.0.orig/src/contents.ts        2019-08-07 13:50:36.000000000 +0200
+++ jupyterlab-gitlab-0.3.0/src/contents.ts     2019-11-04 23:10:09.225345061 +0100
@@ -21,7 +21,7 @@

 import * as base64js from 'base64-js';

-export const DEFAULT_GITLAB_BASE_URL = 'https://gitlab.com';
+export const DEFAULT_GITLAB_BASE_URL = 'https://gitlab.version.fz-juelich.de';

 /**
  * A Contents.IDrive implementation that serves as a read-only

Best regards, Jens Henrik

Edited by Jens Henrik Göbbert