run in docker part 1.0
All checks were successful
ci / build (push) Successful in 1m7s

This commit is contained in:
Christopher Hase 2025-04-16 13:53:25 +02:00
parent 1ddfc8c769
commit f5265a4e1d
6 changed files with 32 additions and 2 deletions

View file

@ -79,7 +79,7 @@ async function sendEmail(content: string) {
} catch (error) {
console.error("Error Sending E-Mail:", error + "\n\n");
console.log("Failed to send horoscope: \n", content + "\n");
console.log("Failed to send this horoscope: \n", content + "\n");
}
}

View file

@ -1,3 +1,11 @@
#env:
# - name: DEPLOY_MODE
# value: "kubernetes"
# - name: BACKEND_PORT
# value: "8090"
#---
# --- DEPLOYMENT --------------------------------------------
apiVersion: apps/v1

1
frontend/deploy.js Normal file
View file

@ -0,0 +1 @@
window.DEPLOY_MODE = "k8s"

View file

@ -1,7 +1,16 @@
function handleClick(): void {
console.log("Der Button wurde geklickt!");
fetch("/iching/api/command", { method: "POST" })
const deployMode = (window as { DEPLOY_MODE?: 'docker' | 'k8s' }).DEPLOY_MODE ?? 'k8s';
const endpoint =
deployMode === 'docker'
? 'http://localhost:8090/iching/api/command'
: '/iching/api/command';
console.log(`DEPLOY_MODE=${deployMode}, sende POST an: ${endpoint}`);
fetch(endpoint, { method: 'POST' })
.then(res => res.text())
.then(text => console.log("HTTP-Server says:", text))
.catch(error => console.error("HTTP-Server - Error:", error));

View file

@ -60,6 +60,8 @@
<div class="footer">🧘 With Love & Fortune from the Cosmos 💫</div>
</div>
<script src="./deploy.js"></script>
<script type="module" src="./event.mjs"></script>
</body>
</html>

View file

@ -1,3 +1,13 @@
#!/bin/bash
# Setze Standard-Wert auf "k8s" wenn DEPLOY_MODE nicht gesetzt ist
DEPLOY_MODE=${DEPLOY_MODE:-k8s}
echo "DEPLOY_MODE ist: $DEPLOY_MODE"
# Injektiere ins Frontend
echo "window.DEPLOY_MODE = \"$DEPLOY_MODE\";" > dist/frontend/deploy.js
# start backend in the background
node dist/backend/server.js &