🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor port mapping logic in setup.sh
Bill Yangf1da7d135a9d
diff --git a/setup.sh b/setup.shindex a40cccec2..13c822bd3 100644--- a/setup.sh+++ b/setup.sh@@ -7,8 +7,6 @@ set -eUSE_WEBSERVER="true"BACKEND_PORT="3001"CLIENT_PORT="3002"-HOST_BACKEND_PORT="127.0.0.1:3001"-HOST_CLIENT_PORT="127.0.0.1:3002"# Help functionshow_help() {@@ -70,17 +68,6 @@ while [[ "$#" -gt 0 ]]; doesacdone-# Update port mappings after all args are parsed-if [ "$USE_WEBSERVER" = "false" ]; then- # When not using the built-in webserver, expose ports to host- HOST_BACKEND_PORT="${BACKEND_PORT}:3001"- HOST_CLIENT_PORT="${CLIENT_PORT}:3002"-else- # Keep ports only accessible via localhost when using Caddy- HOST_BACKEND_PORT="127.0.0.1:3001"- HOST_CLIENT_PORT="127.0.0.1:3002"-fi-# Check if domain name argument is providedif [ -z "$DOMAIN_NAME" ]; thenecho "Error: Domain name is required"@@ -103,6 +90,18 @@ fi# Create or overwrite the .env fileecho "Creating .env file..."++# Update port mappings based on webserver choice+if [ "$USE_WEBSERVER" = "false" ]; then+ # When not using the built-in webserver, expose ports to all interfaces+ HOST_BACKEND_PORT="${BACKEND_PORT}:3001"+ HOST_CLIENT_PORT="${CLIENT_PORT}:3002"+else+ # Keep ports only accessible via localhost when using Caddy+ HOST_BACKEND_PORT="127.0.0.1:${BACKEND_PORT}:3001"+ HOST_CLIENT_PORT="127.0.0.1:${CLIENT_PORT}:3002"+fi+cat > .env << EOL# Variables configured by setup.shDOMAIN_NAME=${DOMAIN_NAME}