Fix homeserver domain configuration for existing configs
This commit is contained in:
17
start.sh
17
start.sh
@ -76,6 +76,7 @@ EOF
|
|||||||
|
|
||||||
if [ -n "${CLOUDRON_APP_DOMAIN:-}" ]; then
|
if [ -n "${CLOUDRON_APP_DOMAIN:-}" ]; then
|
||||||
echo "=> Configuring homeserver and appservice settings"
|
echo "=> Configuring homeserver and appservice settings"
|
||||||
|
# For whatsapp.matrix.as.ci -> matrix.as.ci and domain as.ci
|
||||||
BASE_DOMAIN=$(echo "$CLOUDRON_APP_DOMAIN" | cut -d. -f2-)
|
BASE_DOMAIN=$(echo "$CLOUDRON_APP_DOMAIN" | cut -d. -f2-)
|
||||||
|
|
||||||
# Update homeserver configuration
|
# Update homeserver configuration
|
||||||
@ -103,9 +104,9 @@ EOF
|
|||||||
echo " 5. Authenticate with WhatsApp using QR code scanning"
|
echo " 5. Authenticate with WhatsApp using QR code scanning"
|
||||||
else
|
else
|
||||||
echo "=> Using existing configuration"
|
echo "=> Using existing configuration"
|
||||||
# Fix logging configuration in existing config if needed
|
# Fix configuration in existing config if needed
|
||||||
if [ -f "$CONFIG_PATH" ]; then
|
if [ -f "$CONFIG_PATH" ]; then
|
||||||
# Check if config has problematic logging path and fix it
|
# Fix logging configuration
|
||||||
if grep -q "filename.*logs/" "$CONFIG_PATH" 2>/dev/null || ! grep -q "/app/data/" "$CONFIG_PATH" 2>/dev/null; then
|
if grep -q "filename.*logs/" "$CONFIG_PATH" 2>/dev/null || ! grep -q "/app/data/" "$CONFIG_PATH" 2>/dev/null; then
|
||||||
echo "=> Fixing logging configuration in existing config"
|
echo "=> Fixing logging configuration in existing config"
|
||||||
# Ensure logging goes to the writable /app/data directory
|
# Ensure logging goes to the writable /app/data directory
|
||||||
@ -114,6 +115,18 @@ else
|
|||||||
yq -i ".logging.handlers.console.format = \"json\"" "$CONFIG_PATH" 2>/dev/null || true
|
yq -i ".logging.handlers.console.format = \"json\"" "$CONFIG_PATH" 2>/dev/null || true
|
||||||
yq -i ".logging.level = \"info\"" "$CONFIG_PATH" 2>/dev/null || true
|
yq -i ".logging.level = \"info\"" "$CONFIG_PATH" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fix homeserver domain configuration
|
||||||
|
if [ -n "${CLOUDRON_APP_DOMAIN:-}" ]; then
|
||||||
|
BASE_DOMAIN=$(echo "$CLOUDRON_APP_DOMAIN" | cut -d. -f2-)
|
||||||
|
CURRENT_DOMAIN=$(yq -r ".homeserver.domain // empty" "$CONFIG_PATH" 2>/dev/null)
|
||||||
|
if [ "$CURRENT_DOMAIN" != "$BASE_DOMAIN" ] || [ -z "$CURRENT_DOMAIN" ]; then
|
||||||
|
echo "=> Fixing homeserver domain configuration"
|
||||||
|
yq -i ".homeserver.address = \"https://matrix.$BASE_DOMAIN\"" "$CONFIG_PATH"
|
||||||
|
yq -i ".homeserver.domain = \"$BASE_DOMAIN\"" "$CONFIG_PATH"
|
||||||
|
yq -i ".appservice.address = \"https://$CLOUDRON_APP_DOMAIN\"" "$CONFIG_PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user