Initial dev deployment [infra]

This commit is contained in:
Stephan D
2026-03-16 13:18:22 +01:00
parent 260e514957
commit 311d080aa5
91 changed files with 432 additions and 523 deletions

View File

@@ -1,25 +1,26 @@
#!/bin/sh
set -eu
replace_env_var() {
local var_name=$1
local placeholder="%%$var_name%%"
local value=$(eval echo \$$var_name)
# inject value to the index.html
sed -i "s|$placeholder|$value|g" /usr/share/pweb/index.html
js_escape() {
printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g'
}
echo "Starting Container"
write_app_config() {
cat <<EOF >/usr/share/pweb/app-config.js
window.appConfig = {
apiProto: "$(js_escape "${API_PROTOCOL:-https}")",
apiHost: "$(js_escape "${SERVICE_HOST:-app.sendico.io}")",
apiEndpoint: "$(js_escape "${API_ENDPOINT:-/api/v1}")",
amplitudeSecret: "$(js_escape "${AMPLITUDE_SECRET:-}")",
defaultLocale: "$(js_escape "${DEFAULT_LOCALE:-en}")",
defaultCurrency: "$(js_escape "${DEFAULT_CURRENCY:-EUR}")",
wsProto: "$(js_escape "${WS_PROTOCOL:-wss}")",
wsEndpoint: "$(js_escape "${WS_ENDPOINT:-/ws}")"
};
EOF
}
replace_env_var "WS_PROTOCOL"
replace_env_var "WS_ENDPOINT"
replace_env_var "API_PROTOCOL"
replace_env_var "SERVICE_HOST"
replace_env_var "API_ENDPOINT"
replace_env_var "AMPLITUDE_SECRET"
replace_env_var "DEFAULT_LOCALE"
replace_env_var "DEFAULT_CURRENCY"
echo "Starting container"
write_app_config
echo "Passing by launch command"
# Execute the passed command (e.g., starting Caddy)
# exec "$@"
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile

View File

@@ -33,6 +33,7 @@
<link rel="manifest" href="manifest.json">
</head>
<body>
<script src="app-config.js"></script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>