Skip to content

Commit 8c9876e

Browse files
committed
Fix relay URL configuration to require explicit environment variable
- Remove auto-detection fallback for relay WebSocket URL - Always require REACT_APP_OWN_RELAY_URL to be explicitly set - Prevent panel from incorrectly connecting to ws://localhost:9002 instead of ws://localhost:9001 - Add clear error message when relay URL environment variable is missing - Update .env.production with correct relay URL: ws://localhost:9001
1 parent 1d622bd commit 8c9876e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ PUBLIC_URL=
1515
# REACT_APP_ASSETS_BUCKET=https://your-domain.com
1616

1717
# Nostr relay configuration for profile fetching
18-
# REACT_APP_OWN_RELAY_URL= # ✅ Auto-detected from current domain
18+
REACT_APP_OWN_RELAY_URL=ws://localhost:9001
1919
# REACT_APP_NOSTR_RELAY_URLS=wss://your-relay1.com,wss://your-relay2.com
2020

2121
# Development optimizations

src/config/config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ const config = {
4040
],
4141

4242
// User's own relay URL (primary relay for profile fetching)
43-
// Auto-detect WebSocket URL based on current domain (relay runs on same host, different port or path)
44-
ownRelayUrl: process.env.REACT_APP_OWN_RELAY_URL?.trim() ||
45-
`${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}`,
43+
// Always require explicit relay URL configuration
44+
ownRelayUrl: (() => {
45+
if (!process.env.REACT_APP_OWN_RELAY_URL?.trim()) {
46+
throw new Error('REACT_APP_OWN_RELAY_URL must be explicitly configured in environment variables');
47+
}
48+
return process.env.REACT_APP_OWN_RELAY_URL.trim();
49+
})(),
4650

4751
// Notification settings
4852
notifications: {

0 commit comments

Comments
 (0)