From 637043e59ac4a74c39f0511bc3bb7f84cbdd8c46 Mon Sep 17 00:00:00 2001
From: Petar Hristov <hristov@itc.rwth-aachen.de>
Date: Fri, 23 Feb 2024 11:56:00 +0100
Subject: [PATCH] Update: Read API Hostname from LocalStorage

---
 src/CodeGen/CodeGenerator/CoscineCodeGenerator.cs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/CodeGen/CodeGenerator/CoscineCodeGenerator.cs b/src/CodeGen/CodeGenerator/CoscineCodeGenerator.cs
index 5dfb823..4bcfccc 100644
--- a/src/CodeGen/CodeGenerator/CoscineCodeGenerator.cs
+++ b/src/CodeGen/CodeGenerator/CoscineCodeGenerator.cs
@@ -90,6 +90,10 @@ if (typeof window !== 'undefined') {
 }
 
 const getHostName = () => {
+  const localStorageHostName = typeof window !== 'undefined' ? localStorage.getItem('coscine.api.hostname') : null;
+  if (localStorageHostName) {
+    return localStorageHostName;
+  }
   let hostName = typeof window !== 'undefined' ? window.location.hostname : 'coscine.rwth-aachen.de';
   if (hostName.indexOf(':') !== -1) {
     if (hostName.indexOf('https://') !== -1) {
@@ -103,4 +107,4 @@ const getHostName = () => {
 ";
         return Task.FromResult(combinationFileText);
     }
-}
\ No newline at end of file
+}
-- 
GitLab