From 0b156f5b480047416b08df1fb9b832abd89d63d3 Mon Sep 17 00:00:00 2001
From: Simon Belmas <22192134+simbelmas@users.noreply.github.com>
Date: Mon, 29 Jul 2024 17:55:15 +0200
Subject: [PATCH] allow to run without checking out a repository
---
README.md | 2 +-
config/init.sh | 33 ++++++++++++++++++++++++---------
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index 649c4ae..470c34e 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Ingress fqdn has to be configured by either:
*replicas* and *content-git-repo* in *config* folder can be customized by modifying files or applying kustomize patch
-Connntent git will be displayed in an iframe with node name on top.
+Content git will be displayed in an iframe with node name on top. If it's empty, it will display a blank page with node name.
Node name is displayed on the top of the page and also in kube-node.json and on kube-node.txt
diff --git a/config/init.sh b/config/init.sh
index f7378a0..e656fa5 100644
--- a/config/init.sh
+++ b/config/init.sh
@@ -1,19 +1,23 @@
#!/bin/sh
git_retries=20
try=0
-export GIT_SSH_COMMAND='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
-until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
- echo "Retry git pull after error ($try / $git_retries)"
- try=$((try+1))
- if [ $try -eq $git_retries ]; then
- exit 1
- fi
- sleep 1
-done
+if [ -n "${CONTENT_GIT_REPO}" ] ; then
+ export GIT_SSH_COMMAND='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
+ until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
+ echo "Retry git pull after error ($try / $git_retries)"
+ try=$((try+1))
+ if [ $try -eq $git_retries ]; then
+ exit 1
+ fi
+ sleep 1
+ done
+fi
+
cd /app
if [ -e index.html ] ; then
mv index.html index-embedded.html
fi
+
cat <
as json - text