Add TLS addon and fix startup script configuration issues
This commit is contained in:
@ -11,7 +11,8 @@
|
|||||||
"icon": "logo.png",
|
"icon": "logo.png",
|
||||||
"addons": {
|
"addons": {
|
||||||
"localstorage": {},
|
"localstorage": {},
|
||||||
"postgresql": {}
|
"postgresql": {},
|
||||||
|
"tls": {}
|
||||||
},
|
},
|
||||||
"manifestVersion": 2,
|
"manifestVersion": 2,
|
||||||
"website": "https://docs.mau.fi/bridges/go/whatsapp/index.html",
|
"website": "https://docs.mau.fi/bridges/go/whatsapp/index.html",
|
||||||
|
20
start.sh
20
start.sh
@ -23,7 +23,8 @@ BACKUP_PATH="/app/data/config.yaml.bak"
|
|||||||
# Create example config from built-in template
|
# Create example config from built-in template
|
||||||
if [ ! -f "$CONFIG_PATH" ]; then
|
if [ ! -f "$CONFIG_PATH" ]; then
|
||||||
echo "=> Generating example configuration"
|
echo "=> Generating example configuration"
|
||||||
/usr/local/bin/gosu cloudron:cloudron /app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH"
|
# Generate config as root first, then fix permissions
|
||||||
|
/app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH"
|
||||||
|
|
||||||
# Configure for Cloudron environment
|
# Configure for Cloudron environment
|
||||||
if [ -n "${CLOUDRON_POSTGRESQL_URL:-}" ]; then
|
if [ -n "${CLOUDRON_POSTGRESQL_URL:-}" ]; then
|
||||||
@ -65,16 +66,13 @@ fi
|
|||||||
# Final permission fix before starting
|
# Final permission fix before starting
|
||||||
chown -R cloudron:cloudron /app/data
|
chown -R cloudron:cloudron /app/data
|
||||||
|
|
||||||
# Create a health check endpoint (run in background)
|
# Configure TLS if certificates are available
|
||||||
mkdir -p /run/health
|
if [ -f "/run/tls/tls.crt" ] && [ -f "/run/tls/tls.key" ]; then
|
||||||
echo '#!/bin/bash
|
echo "=> Configuring TLS certificates"
|
||||||
echo "HTTP/1.1 200 OK"
|
yq eval ".appservice.tls_cert = \"/run/tls/tls.crt\"" -i "$CONFIG_PATH"
|
||||||
echo "Content-Type: text/plain"
|
yq eval ".appservice.tls_key = \"/run/tls/tls.key\"" -i "$CONFIG_PATH"
|
||||||
echo ""
|
fi
|
||||||
echo "OK"' > /run/health/server.sh
|
|
||||||
chmod +x /run/health/server.sh
|
|
||||||
(cd /run/health && nohup nc -l -p 29318 -e ./server.sh > /dev/null 2>&1) &
|
|
||||||
|
|
||||||
# Start the bridge
|
# Start the bridge
|
||||||
echo "=> Starting mautrix-whatsapp bridge"
|
echo "=> Starting mautrix-whatsapp bridge"
|
||||||
exec /usr/local/bin/gosu cloudron:cloudron /app/pkg/mautrix-whatsapp -c "$CONFIG_PATH"
|
exec gosu cloudron:cloudron /app/pkg/mautrix-whatsapp -c "$CONFIG_PATH"
|
Reference in New Issue
Block a user