Skip to content
Draft
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ 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)
17 changes: 16 additions & 1 deletion packages/client/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
NEXT_PUBLIC_MAPSAPIKEY=''
NEXT_PUBLIC_MAPSAPIKEY=''

# Production URL for the backend API
# 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 (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=

# Socket URL (keep for backward compatibility with existing configurations)
SOCKET_URL=localhost:3001
11 changes: 7 additions & 4 deletions packages/shared/src/prodFlag.ts
Original file line number Diff line number Diff line change
@@ -1,9 +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";

export const prodURL =
process.env.NODE_ENV === "production"
? "https://aedes.calgarysolarcar.ca:3001"
envProdURL && envProdURL.trim() !== ""
? envProdURL
: "http://localhost:3001";