From 9b22b3c77acac3901c6848cec4ec149970a26b27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 17:36:14 +0000 Subject: [PATCH 1/7] Initial plan From e82695b1330e475934491d35ee97cdd6bf916c76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 17:40:14 +0000 Subject: [PATCH 2/7] Replace hardcoded PROD_URL with environment variable Co-authored-by: justin-phxm <113923596+justin-phxm@users.noreply.github.com> --- README.md | 1 + packages/client/.env.example | 7 ++++++- packages/shared/src/prodFlag.ts | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c71e537b..c7314161 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ In packages/client `.env`: ``` NEXT_PUBLIC_MAPSAPIKEY= +NEXT_PUBLIC_PROD_URL= ``` Ask your lead for these keys or find them in [Confluence](https://uofcsolarcar.atlassian.net/wiki/spaces/ST/pages/345964547/Helios+Telemetry+Environment+Variables) diff --git a/packages/client/.env.example b/packages/client/.env.example index 133a736a..40058de3 100644 --- a/packages/client/.env.example +++ b/packages/client/.env.example @@ -1 +1,6 @@ -NEXT_PUBLIC_MAPSAPIKEY='' \ No newline at end of file +NEXT_PUBLIC_MAPSAPIKEY='' + +# Production URL for the backend API +# Example: https://aedes.calgarysolarcar.ca:3001 +# Leave empty to use default behavior (prod: https://aedes.calgarysolarcar.ca:3001, dev: http://localhost:3001) +NEXT_PUBLIC_PROD_URL= \ No newline at end of file diff --git a/packages/shared/src/prodFlag.ts b/packages/shared/src/prodFlag.ts index 0ca6433c..d8d56267 100644 --- a/packages/shared/src/prodFlag.ts +++ b/packages/shared/src/prodFlag.ts @@ -4,6 +4,7 @@ export const socketURL = : "http://localhost:3001"; export const prodURL = - process.env.NODE_ENV === "production" + process.env.NEXT_PUBLIC_PROD_URL || + (process.env.NODE_ENV === "production" ? "https://aedes.calgarysolarcar.ca:3001" - : "http://localhost:3001"; + : "http://localhost:3001"); From c4b55a50cf886fc3602182c7d0ed29ad806a40bd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 17:42:59 +0000 Subject: [PATCH 3/7] Fix empty string handling for NEXT_PUBLIC_PROD_URL Co-authored-by: justin-phxm <113923596+justin-phxm@users.noreply.github.com> --- packages/shared/src/prodFlag.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/prodFlag.ts b/packages/shared/src/prodFlag.ts index d8d56267..675f0147 100644 --- a/packages/shared/src/prodFlag.ts +++ b/packages/shared/src/prodFlag.ts @@ -4,7 +4,9 @@ export const socketURL = : "http://localhost:3001"; export const prodURL = - process.env.NEXT_PUBLIC_PROD_URL || + (process.env.NEXT_PUBLIC_PROD_URL && + process.env.NEXT_PUBLIC_PROD_URL.trim() !== "") ? + process.env.NEXT_PUBLIC_PROD_URL : (process.env.NODE_ENV === "production" ? "https://aedes.calgarysolarcar.ca:3001" : "http://localhost:3001"); From c58d0143237ba4ebcd420ca073bfc99291408a80 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 17:43:30 +0000 Subject: [PATCH 4/7] Improve code readability for environment variable handling Co-authored-by: justin-phxm <113923596+justin-phxm@users.noreply.github.com> --- packages/shared/src/prodFlag.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/shared/src/prodFlag.ts b/packages/shared/src/prodFlag.ts index 675f0147..a12a02e4 100644 --- a/packages/shared/src/prodFlag.ts +++ b/packages/shared/src/prodFlag.ts @@ -3,10 +3,11 @@ export const socketURL = ? "aedes.calgarysolarcar.ca:3001" : "http://localhost:3001"; +const envProdURL = process.env.NEXT_PUBLIC_PROD_URL; + export const prodURL = - (process.env.NEXT_PUBLIC_PROD_URL && - process.env.NEXT_PUBLIC_PROD_URL.trim() !== "") ? - process.env.NEXT_PUBLIC_PROD_URL : - (process.env.NODE_ENV === "production" - ? "https://aedes.calgarysolarcar.ca:3001" - : "http://localhost:3001"); + envProdURL && envProdURL.trim() !== "" + ? envProdURL + : process.env.NODE_ENV === "production" + ? "https://aedes.calgarysolarcar.ca:3001" + : "http://localhost:3001"; From 4b7ffc0b5be8adbfec647fc874156d8813f96fdf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 17:59:40 +0000 Subject: [PATCH 5/7] Remove hardcoded aedes.calgarysolarcar.ca URLs from codebase Co-authored-by: justin-phxm <113923596+justin-phxm@users.noreply.github.com> --- README.md | 1 + packages/client/.env.example | 13 ++++++++++--- packages/shared/src/prodFlag.ts | 13 ++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c7314161..8575a64d 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ In packages/client `.env`: ``` NEXT_PUBLIC_MAPSAPIKEY= NEXT_PUBLIC_PROD_URL= +NEXT_PUBLIC_SOCKET_URL= ``` Ask your lead for these keys or find them in [Confluence](https://uofcsolarcar.atlassian.net/wiki/spaces/ST/pages/345964547/Helios+Telemetry+Environment+Variables) diff --git a/packages/client/.env.example b/packages/client/.env.example index 40058de3..537b8061 100644 --- a/packages/client/.env.example +++ b/packages/client/.env.example @@ -1,6 +1,13 @@ NEXT_PUBLIC_MAPSAPIKEY='' # Production URL for the backend API -# Example: https://aedes.calgarysolarcar.ca:3001 -# Leave empty to use default behavior (prod: https://aedes.calgarysolarcar.ca:3001, dev: http://localhost:3001) -NEXT_PUBLIC_PROD_URL= \ No newline at end of file +# Set this to your backend API URL in production +# Example: https://your-backend-url.com:3001 +# Defaults to http://localhost:3001 if not set +NEXT_PUBLIC_PROD_URL= + +# Socket URL for real-time communication +# Set this to your socket server URL in production +# Example: your-socket-url.com:3001 +# Defaults to http://localhost:3001 if not set +NEXT_PUBLIC_SOCKET_URL= \ No newline at end of file diff --git a/packages/shared/src/prodFlag.ts b/packages/shared/src/prodFlag.ts index a12a02e4..3ad54344 100644 --- a/packages/shared/src/prodFlag.ts +++ b/packages/shared/src/prodFlag.ts @@ -1,13 +1,12 @@ +const envSocketURL = process.env.NEXT_PUBLIC_SOCKET_URL; +const envProdURL = process.env.NEXT_PUBLIC_PROD_URL; + export const socketURL = - process.env.NODE_ENV === "production" - ? "aedes.calgarysolarcar.ca:3001" + envSocketURL && envSocketURL.trim() !== "" + ? envSocketURL : "http://localhost:3001"; -const envProdURL = process.env.NEXT_PUBLIC_PROD_URL; - export const prodURL = envProdURL && envProdURL.trim() !== "" ? envProdURL - : process.env.NODE_ENV === "production" - ? "https://aedes.calgarysolarcar.ca:3001" - : "http://localhost:3001"; + : "http://localhost:3001"; From f107036e519a5c31c296abfd2996cdc8d7f968a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:00:29 +0000 Subject: [PATCH 6/7] Clarify socket URL example to show protocol flexibility Co-authored-by: justin-phxm <113923596+justin-phxm@users.noreply.github.com> --- packages/client/.env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/.env.example b/packages/client/.env.example index 537b8061..2568e35a 100644 --- a/packages/client/.env.example +++ b/packages/client/.env.example @@ -7,7 +7,7 @@ NEXT_PUBLIC_MAPSAPIKEY='' NEXT_PUBLIC_PROD_URL= # Socket URL for real-time communication -# Set this to your socket server URL in production -# Example: your-socket-url.com:3001 +# Set this to your socket server URL in production (with or without protocol) +# Examples: wss://your-socket-url.com:3001 or your-socket-url.com:3001 # Defaults to http://localhost:3001 if not set NEXT_PUBLIC_SOCKET_URL= \ No newline at end of file From c79fe728c6857c2a97fcb909091069047d152923 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:05:35 +0000 Subject: [PATCH 7/7] Resolve merge conflict: add SOCKET_URL from main branch Co-authored-by: justin-phxm <113923596+justin-phxm@users.noreply.github.com> --- packages/client/.env.example | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/client/.env.example b/packages/client/.env.example index 2568e35a..3b55e32b 100644 --- a/packages/client/.env.example +++ b/packages/client/.env.example @@ -10,4 +10,7 @@ NEXT_PUBLIC_PROD_URL= # Set this to your socket server URL in production (with or without protocol) # Examples: wss://your-socket-url.com:3001 or your-socket-url.com:3001 # Defaults to http://localhost:3001 if not set -NEXT_PUBLIC_SOCKET_URL= \ No newline at end of file +NEXT_PUBLIC_SOCKET_URL= + +# Socket URL (keep for backward compatibility with existing configurations) +SOCKET_URL=localhost:3001 \ No newline at end of file