Skip to content

Commit

Permalink
build: rename FMTM_PORT --> FMTM_DEV_PORT for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Nov 5, 2023
1 parent 75f1b70 commit 4d77c15
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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:-/}
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}
Expand Down
24 changes: 9 additions & 15 deletions scripts/gen-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]] = []

Expand All @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/public/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 4d77c15

Please sign in to comment.