Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/core.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ location /private-media/ {
}

location /ws/ {
set $core_upstream core:8080;
set $core_upstream core:WS_LISTEN_PORT;
proxy_pass http://$core_upstream;
proxy_buffering off;
proxy_http_version 1.1;
Expand Down
16 changes: 16 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ function config_gzip() {
fi
}

function config_ws_listen_port() {
core_config_file=/etc/nginx/includes/core.conf
if [ ! -f "${core_config_file}" ]; then
return
fi

ws_listen_port=${WS_LISTEN_PORT:-8080}
if [[ ! "${ws_listen_port}" =~ ^[0-9]+$ ]]; then
echo "Invalid WS_LISTEN_PORT: ${WS_LISTEN_PORT}, fallback to 8080"
ws_listen_port=8080
fi

sed -i "s@core:WS_LISTEN_PORT;@core:${ws_listen_port};@g" "${core_config_file}"
}

function main() {
if [ -f "/etc/nginx/sites-enabled/jms.conf" ]; then
config_helm
Expand All @@ -157,6 +172,7 @@ function main() {
config_https
fi
config_components
config_ws_listen_port

if [ -f "/etc/init.d/cron" ]; then
/etc/init.d/cron start
Expand Down