From 4390e1a7b9ddfb48d548112b63d0f5012cd7d4e7 Mon Sep 17 00:00:00 2001
From: Tim Kreuzer <t.kreuzer@fz-juelich.de>
Date: Sun, 25 May 2025 20:10:20 +0200
Subject: [PATCH] add denbiCloud Check

---
 jsc_custom/handler/share_handler.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/jsc_custom/handler/share_handler.py b/jsc_custom/handler/share_handler.py
index ff7d0d9..a5912ed 100644
--- a/jsc_custom/handler/share_handler.py
+++ b/jsc_custom/handler/share_handler.py
@@ -9,6 +9,7 @@ from jupyterhub.handlers.pages import SpawnHandler
 from jupyterhub.utils import url_path_join
 from tornado import web
 
+from ..misc import get_custom_config
 from ..orm.share import UserOptionsShares
 
 
@@ -160,8 +161,6 @@ class R2DHandler(SpawnHandler):
                 "urlpath"
             )[0].decode("utf-8")
 
-        # https://jupyter-jsc-dev2.fz-juelich.de/hub/r2d/gh/FZJ-JSC/jupyter-jsc-notebooks
-
         # Get System
         auth_state = await user.get_auth_state()
         if len(arguments_dict_lower.get("system", [])) > 0:
@@ -169,7 +168,15 @@ class R2DHandler(SpawnHandler):
         elif len(auth_state.get("outpost_flavors", {}).keys()) > 0:
             system = list(auth_state.get("outpost_flavors", {}).keys())[0]
         else:
-            system = "JSC-Cloud"
+            try:
+                custom_config = get_custom_config()
+                if "deNBI-Cloud" in custom_config.get("systems", {}).keys():
+                    system = "deNBI-Cloud"
+                else:
+                    system = "JSC-Cloud"
+            except:
+                self.log.exception("Could not check for systems")
+                system = "JSC-Cloud"
         user_options["system"] = system
 
         # Get Flavor
-- 
GitLab