diff --git a/.env.example b/.env.example index 3cff87bb18..6257f68fd3 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,7 @@ DEBUG=${DEBUG:-False} LOG_LEVEL=${LOG_LEVEL:-INFO} EXTRA_CORS_ORIGINS=${EXTRA_CORS_ORIGINS} FMTM_DOMAIN=${FMTM_DOMAIN:-"fmtm.localhost"} -FMTM_PORT=${FMTM_PORT:-7050} +FMTM_DEV_PORT=${FMTM_DEV_PORT:-7050} CERT_EMAIL=${CERT_EMAIL} # Use API_PREFIX if running behind a proxy subpath (e.g. /api) API_PREFIX=${API_PREFIX:-/} diff --git a/docker-compose.yml b/docker-compose.yml index 414b44718a..4f7d0ba042 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,7 +55,7 @@ services: volumes: - central_frontend:/usr/share/nginx/html/central ports: - - ${FMTM_PORT:-7050}:80 + - ${FMTM_DEV_PORT:-7050}:80 networks: - fmtm-net restart: "unless-stopped" @@ -112,7 +112,7 @@ services: - ./src/frontend:/app - /app/node_modules/ environment: - - VITE_API_URL=http://api.${FMTM_DOMAIN}:${FMTM_PORT:-7050} + - VITE_API_URL=http://api.${FMTM_DOMAIN}:${FMTM_DEV_PORT:-7050} - VITE_ODK_CENTRAL_URL=${ODK_CENTRAL_URL} - VITE_ODK_CENTRAL_USER=${ODK_CENTRAL_USER} - VITE_ODK_CENTRAL_PASSWD=${ODK_CENTRAL_PASSWD} diff --git a/scripts/gen-env.sh b/scripts/gen-env.sh index 5d3e91b3dc..bec45c9f2a 100644 --- a/scripts/gen-env.sh +++ b/scripts/gen-env.sh @@ -365,23 +365,17 @@ set_osm_credentials() { } check_change_port() { - pretty_echo "Set Default Port" + heading_echo "Set Default Port" echo "The default port for local development is 7050." echo - while true - do - read -e -p "Enter a different port if required, or nothing for default: " fmtm_port - - if [ "$fmtm_port" == "" ] - then - echo "Using port 7050 for FMTM." - break - else - echo "Using $fmtm_port" - export FMTM_PORT="$fmtm_port" - break - fi - done + read -e -p "Enter a different port if required, or nothing for default: " fmtm_port + + if [ -n "$fmtm_port" ]; then + echo "Using $fmtm_port" + export FMTM_DEV_PORT="$fmtm_port" + else + echo "Using port 7050 for FMTM." + fi } generate_dotenv() { diff --git a/src/backend/app/config.py b/src/backend/app/config.py index b6242620c4..27a0698365 100644 --- a/src/backend/app/config.py +++ b/src/backend/app/config.py @@ -32,7 +32,7 @@ class Settings(BaseSettings): LOG_LEVEL: str = "INFO" FMTM_DOMAIN: Optional[str] - FMTM_PORT: Optional[str] = "7050" + FMTM_DEV_PORT: Optional[str] = "7050" EXTRA_CORS_ORIGINS: Optional[Union[str, list[str]]] = [] @@ -53,7 +53,7 @@ def assemble_cors_origins( # Build default origins from env vars url_scheme = "http" if info.data.get("DEBUG") else "https" local_server_port = ( - f":{info.data.get('FMTM_PORT')}" if info.data.get("DEBUG") else "" + f":{info.data.get('FMTM_DEV_PORT')}" if info.data.get("DEBUG") else "" ) if frontend_domain := info.data.get("FMTM_DOMAIN"): default_origins = [ diff --git a/src/frontend/public/install.sh b/src/frontend/public/install.sh index 0f90784c2c..fd489cceeb 100644 --- a/src/frontend/public/install.sh +++ b/src/frontend/public/install.sh @@ -735,7 +735,7 @@ check_change_port() { if [ -n "$fmtm_port" ]; then echo "Using $fmtm_port" - export FMTM_PORT="$fmtm_port" + export FMTM_DEV_PORT="$fmtm_port" else echo "Using port 7050 for FMTM." fi @@ -829,7 +829,7 @@ final_output() { if [ "$IS_TEST" != true ]; then proto="https" else - suffix=":${FMTM_PORT:-7050}" + suffix=":${FMTM_DEV_PORT:-7050}" fi heading_echo "FMTM Setup Complete"