This commit is contained in:
parent
1ddfc8c769
commit
f5265a4e1d
6 changed files with 32 additions and 2 deletions
|
@ -79,7 +79,7 @@ async function sendEmail(content: string) {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error Sending E-Mail:", error + "\n\n");
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
#env:
|
||||||
|
# - name: DEPLOY_MODE
|
||||||
|
# value: "kubernetes"
|
||||||
|
# - name: BACKEND_PORT
|
||||||
|
# value: "8090"
|
||||||
|
|
||||||
|
#---
|
||||||
|
|
||||||
# --- DEPLOYMENT --------------------------------------------
|
# --- DEPLOYMENT --------------------------------------------
|
||||||
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
|
|
1
frontend/deploy.js
Normal file
1
frontend/deploy.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
window.DEPLOY_MODE = "k8s"
|
|
@ -1,7 +1,16 @@
|
||||||
function handleClick(): void {
|
function handleClick(): void {
|
||||||
console.log("Der Button wurde geklickt!");
|
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(res => res.text())
|
||||||
.then(text => console.log("HTTP-Server says:", text))
|
.then(text => console.log("HTTP-Server says:", text))
|
||||||
.catch(error => console.error("HTTP-Server - Error:", error));
|
.catch(error => console.error("HTTP-Server - Error:", error));
|
||||||
|
|
|
@ -60,6 +60,8 @@
|
||||||
<div class="footer">🧘 With Love & Fortune from the Cosmos 💫</div>
|
<div class="footer">🧘 With Love & Fortune from the Cosmos 💫</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="./deploy.js"></script>
|
||||||
|
|
||||||
<script type="module" src="./event.mjs"></script>
|
<script type="module" src="./event.mjs"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
10
start.sh
10
start.sh
|
@ -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
|
# start backend in the background
|
||||||
node dist/backend/server.js &
|
node dist/backend/server.js &
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue