uchill/docker/jitsi/web/fix-config.sh

21 lines
1.1 KiB
Bash

#!/bin/bash
# Скрипт для исправления config.js после генерации
# Заменяет localhost на 127.0.0.1 и https/wss на http/ws
# Этот скрипт должен запускаться после генерации config.js скриптом 10-config
CONFIG_FILE="/config/config.js"
if [ -f "$CONFIG_FILE" ]; then
# Заменяем https://localhost:8443 на http://127.0.0.1:8443
sed -i 's|https://localhost:8443|http://127.0.0.1:8443|g' "$CONFIG_FILE"
# Заменяем wss://localhost:8443 на ws://127.0.0.1:8443
sed -i 's|wss://localhost:8443|ws://127.0.0.1:8443|g' "$CONFIG_FILE"
# Также заменяем без поддиректории
sed -i "s|'https://localhost:8443/'|'http://127.0.0.1:8443/'|g" "$CONFIG_FILE"
sed -i "s|'wss://localhost:8443/'|'ws://127.0.0.1:8443/'|g" "$CONFIG_FILE"
echo "[fix-config.sh] Config.js исправлен: localhost заменен на 127.0.0.1, https/wss заменены на http/ws"
else
echo "[fix-config.sh] Файл $CONFIG_FILE не найден"
fi