From 958b97a808139736b531603b7144a50810411301 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de>
Date: Thu, 21 Jul 2022 10:49:11 +0200
Subject: [PATCH] Load API URL from env variable and restructure gitlab CI

#2
---
 .gitlab-ci.yml             | 14 ++++----------
 src/client/core/OpenAPI.ts |  2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 40c0215..850d339 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,30 +1,24 @@
 image: node:16
 cache:
   paths:
-    - dist
     - node_modules
+
 stages:
-  - prepare
   - test
   - build
 
-prepare:
-  stage: prepare
-  script:
-    - npm install
+before_script:
+  - npm --version  # For debugging
+  - npm install
 
 lint:
   stage: test
-  needs:
-    - prepare
   script:
     - npm run lint
     - npm run type-check
 
 build:
   stage: build
-  needs:
-    - prepare
   script:
     - npm run build-only
   artifacts:
diff --git a/src/client/core/OpenAPI.ts b/src/client/core/OpenAPI.ts
index dba8bdb..4ca423b 100644
--- a/src/client/core/OpenAPI.ts
+++ b/src/client/core/OpenAPI.ts
@@ -19,7 +19,7 @@ export type OpenAPIConfig = {
 };
 
 export const OpenAPI: OpenAPIConfig = {
-    BASE: 'http://localhost:9999/api',
+    BASE: import.meta.env.VITE_API_BASE_URL != null ? import.meta.env.VITE_API_BASE_URL : 'http://localhost:9999/api',
     VERSION: '1.0.0',
     WITH_CREDENTIALS: false,
     CREDENTIALS: 'include',
-- 
GitLab