From b9c65d71434e9f901822d19fe1cae6fde8cf7f64 Mon Sep 17 00:00:00 2001
From: Fawzi Mohamed <fawzi.mohamed@fhi-berlin.mpg.de>
Date: Fri, 12 Oct 2018 17:57:30 +0200
Subject: [PATCH] new prefix/cM/* for start and commands, use prefix, remove
 baseUri

analytics-toolkit beaker still using old /notebook-edit entrypoint
---
 app/components.js              | 9 ++++-----
 config/analytics-toolkit.hjson | 6 ++++++
 config/default-beaker.hjson    | 4 +---
 config/default-jupyter.hjson   | 3 +--
 config/default.hjson           | 9 ++++-----
 5 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/app/components.js b/app/components.js
index c48a93c..77d1278 100644
--- a/app/components.js
+++ b/app/components.js
@@ -14,12 +14,11 @@ const yaml = require('js-yaml')
 
 var baseRepl = {
   baseDir: baseDir,
-  baseUri: config.app.baseUri,
-  baseUriPath: url.parse(config.app.baseUri).path
+  prefix: config.k8component.image.prefix
 };
-// ensure that baseUriPath does not end with /
-if (baseRepl.baseUriPath.endsWith('/'))
-  baseRepl.baseUriPath = baseRepl.baseUriPath.slice(0, baseRepl.baseUriPath.length -1)
+// ensure that prefix does not end with /
+if (baseRepl.prefix.endsWith('/'))
+  baseRepl.prefix = baseRepl.prefix.slice(0, baseRepl.prefix.length -1)
 const br = config.app.baseReplacements
 for (k in br)
   baseRepl[k] = br[k];
diff --git a/config/analytics-toolkit.hjson b/config/analytics-toolkit.hjson
index 72fc90f..d0f919c 100644
--- a/config/analytics-toolkit.hjson
+++ b/config/analytics-toolkit.hjson
@@ -26,4 +26,10 @@
      port: 6390,
      host: 'analytics-toolkit.nomad-coe.eu'
   }
+  k8component: {
+    entryPoint: {
+      path: "/notebook-edit/*"
+      pathReStr: "/notebook-edit(/[^?#]*)(\\?[^#]*)?(#.*)?$"
+    }
+  }
 }
diff --git a/config/default-beaker.hjson b/config/default-beaker.hjson
index 410dd7f..7d4b3e7 100644
--- a/config/default-beaker.hjson
+++ b/config/default-beaker.hjson
@@ -12,9 +12,7 @@ k8component: {
     liveDelay: 15
   }
   entryPoint: {
-    path: "/notebook-edit/*"
-    pathReStr: "/notebook-edit(/[^?#]*)(\\?[^#]*)?(#.*)?$"
-    redirectTarget: "{{baseUri}}/beaker/#/open?uri={{escapedPath1}}"
+    redirectTarget: "{{prefix}}/#/open?uri={{escapedPath1}}"
     execCommand: []
     exclusiveStartPoint: false
   }
diff --git a/config/default-jupyter.hjson b/config/default-jupyter.hjson
index da8bef7..ed94056 100644
--- a/config/default-jupyter.hjson
+++ b/config/default-jupyter.hjson
@@ -8,7 +8,6 @@ k8component: {
     image: "analytics-toolkit.nomad-coe.eu:5509/nomadlab/jupyter-image:0.999"
     port: 8888,
     prefix: "/jupyter",
-    homePath: "/home/beaker"
     healthPath: "/jupyter"
     healthDelay: 2
     healthPeriod: 10
@@ -19,7 +18,7 @@ k8component: {
   "entryPoint": {
     "path": "/jupyter/entrypoint"
     "uriRe": "/jupyter(/.*)",
-    "redirectTarget": "{{baseUri}}/jupyter/tree?",
+    "redirectTarget": "{{prefix}}/tree?",
     "exclusiveStartPoint": false
   },
 }
diff --git a/config/default.hjson b/config/default.hjson
index 5c3a7e2..c135c41 100644
--- a/config/default.hjson
+++ b/config/default.hjson
@@ -9,7 +9,6 @@ app: {
   resolveCacheNMax: 30000
   pageReloadTime: 5
   frontendAddr: "http://127.0.0.1:4200"
-  baseUri: "http://127.0.0.1"
   catchErrors: false
   templatesDir: "{{baseDir}}/templates"
   baseReplacements: {
@@ -71,14 +70,14 @@ k8component: {
     checksumSkipReStr: "^(?:path[0-9]*|escapedPath[0-9]*)$"
   }
   entryPoint: {
-    path: "/notebook-edit/*"
-    pathReStr: "/notebook-edit(/[^?#]*)(\\?[^#]*)?(#.*)?$"
-    redirectTarget: "{{baseUri}}/beaker/#/open?uri={{escapedPath1}}"
+    path: "{{commands}}/start/*"
+    pathReStr: "/start(/[^?#]*)(\\?[^#]*)?(#.*)?$"
+    redirectTarget: "{{prefix}}/"
     execCommand: []
     exclusiveStartPoint: false
   }
   commands: {
-    path: "{{baseUriPath}}/cM"
+    path: "{{prefix}}/cM"
   }
 }
 userInfo: {
-- 
GitLab