From 508967de1ad06882cf7e7631cba2dfafdcfafd7c Mon Sep 17 00:00:00 2001
From: Christophe Chaudier <christophe@lydra.fr>
Date: Wed, 16 Nov 2022 18:56:07 +0100
Subject: [PATCH] ci: use env var for URL

---
 .gitlab-ci.yml   | 6 ++++++
 astro.config.mjs | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e021035..a1d5459 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,11 @@
 # The Docker image that will be used to build your app
 image: node:16.13.2-slim
 
+variables:
+  ASTRO_URL:  "https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}"
+  ASTRO_BASE: "/${CI_PROJECT_NAMESPACE}"
+
+
 pages:
   stage: deploy
   tags:
@@ -10,6 +15,7 @@ pages:
       - node_modules/
   script:
     # Specify the steps involved to build your app here
+    - echo "Astro full URL is ${ASTRO_URL}${ASTRO_BASE}"
     - npm ci
     - npm run build
   artifacts:
diff --git a/astro.config.mjs b/astro.config.mjs
index 3f486da..20830de 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -6,6 +6,6 @@ export default defineConfig({
   sitemap: true,
   outDir: 'public',
   publicDir: 'static',
-  site: 'https://froggit.froggit.page',
-  base: '/poc/astrojs'
+  site: process.env.ASTRO_URL ||'https://domain.tld',
+  base: process.env.ASTRO_BASE || '/'
 });
-- 
GitLab