clean up env vars: remove obsolete, add missing

Commented out unused environment variables in .env.example:
- VITE_MARKET_RELAYS (market uses VITE_NOSTR_RELAYS instead)
- VITE_SUPPORT_NPUB (config.support.npub never consumed)
- VITE_LIGHTNING_ENABLED (config.market.lightningEnabled never consumed)
- VITE_MARKET_DEFAULT_CURRENCY (config.market.defaultCurrency never consumed)

Added missing environment variables to .env.example:
- VITE_APP_NAME (used in market module)
- VITE_LNBITS_DEBUG (used in lnbits config)
- VITE_WEBSOCKET_ENABLED (used in app config)

Also commented out corresponding unused config in src/lib/config/index.ts:
- MarketConfig.lightningEnabled and defaultCurrency
- AppConfig.nostrclient (defined but never used)
- AppConfig.support (never consumed)

Removed legacy VITE_API_BASE_URL fallback from WalletWebSocketService.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
padreug 2025-12-31 08:27:58 +01:00
parent 3d69cfa15d
commit 4a95258acf
3 changed files with 42 additions and 25 deletions

View file

@ -1,3 +1,6 @@
# App Configuration
VITE_APP_NAME=MyApp
# Nostr Configuration
VITE_NOSTR_RELAYS=["wss://relay.damus.io","wss://relay.snort.social"]
VITE_ADMIN_PUBKEYS=["your-admin-pubkey-here"]
@ -5,6 +8,8 @@ VITE_ADMIN_PUBKEYS=["your-admin-pubkey-here"]
# API Configuration
VITE_LNBITS_BASE_URL=http://localhost:5000
VITE_API_KEY=your-api-key-here
VITE_LNBITS_DEBUG=false
VITE_WEBSOCKET_ENABLED=true
# Lightning Address Domain (optional)
# Override the domain used for Lightning Addresses
@ -17,13 +22,17 @@ VITE_VAPID_PUBLIC_KEY=your-vapid-public-key
VITE_PUSH_NOTIFICATIONS_ENABLED=true
# Support
VITE_SUPPORT_NPUB=your-support-npub
# OBSOLETE: Not used in codebase - config.support.npub is never consumed
# VITE_SUPPORT_NPUB=your-support-npub
# Image Upload Configuration (pict-rs)
VITE_PICTRS_BASE_URL=https://img.mydomain.com
# Market Configuration
VITE_MARKET_NADDR=naddr1qqjxgdp4vv6rydej943n2dny956rwwf4943xzwfc95ekyd3evenrsvrrvc6r2qf8waehxw309akxucnfw3ejuct5d96xcctw9e5k7tmwdaehgunjv4kxz7f0v96xjmczyqrfrfkxv3m8t4elpe28x065z30zszaaqa4u0744qcmadsz3y50cjqcyqqq82scmcafla
VITE_MARKET_RELAYS=["wss://relay.damus.io","wss://relay.snort.social","wss://nostr-pub.wellorder.net"]
VITE_LIGHTNING_ENABLED=true
VITE_MARKET_DEFAULT_CURRENCY=sat
# OBSOLETE: Not used in codebase - market uses VITE_NOSTR_RELAYS instead
# VITE_MARKET_RELAYS=["wss://relay.damus.io","wss://relay.snort.social","wss://nostr-pub.wellorder.net"]
# OBSOLETE: Not used in codebase - config.market.lightningEnabled is never consumed
# VITE_LIGHTNING_ENABLED=true
# OBSOLETE: Not used in codebase - config.market.defaultCurrency is never consumed
# VITE_MARKET_DEFAULT_CURRENCY=sat

View file

@ -19,8 +19,10 @@ interface PushConfig {
interface MarketConfig {
defaultNaddr: string
lightningEnabled: boolean
defaultCurrency: string
// OBSOLETE: lightningEnabled is never consumed in the codebase
// lightningEnabled: boolean
// OBSOLETE: defaultCurrency is never consumed in the codebase
// defaultCurrency: string
}
interface AppConfig {
@ -28,13 +30,15 @@ interface AppConfig {
api: ApiConfig
push: PushConfig
market: MarketConfig
nostrclient: {
url: string
enabled: boolean
}
support: {
npub: string
}
// OBSOLETE: nostrclient config is never consumed in the codebase
// nostrclient: {
// url: string
// enabled: boolean
// }
// OBSOLETE: support config is never consumed in the codebase
// support: {
// npub: string
// }
}
// Parse JSON environment variables safely
@ -65,17 +69,21 @@ export const config: AppConfig = {
enabled: Boolean(import.meta.env.VITE_PUSH_NOTIFICATIONS_ENABLED)
},
market: {
defaultNaddr: import.meta.env.VITE_MARKET_NADDR || '',
lightningEnabled: Boolean(import.meta.env.VITE_LIGHTNING_ENABLED),
defaultCurrency: import.meta.env.VITE_MARKET_DEFAULT_CURRENCY || 'sat'
},
nostrclient: {
url: import.meta.env.VITE_NOSTRCLIENT_URL || 'wss://localhost:5000/nostrclient/api/v1',
enabled: Boolean(import.meta.env.VITE_NOSTRCLIENT_ENABLED)
},
support: {
npub: import.meta.env.VITE_SUPPORT_NPUB || ''
defaultNaddr: import.meta.env.VITE_MARKET_NADDR || ''
// OBSOLETE: lightningEnabled is never consumed in the codebase
// lightningEnabled: Boolean(import.meta.env.VITE_LIGHTNING_ENABLED),
// OBSOLETE: defaultCurrency is never consumed in the codebase
// defaultCurrency: import.meta.env.VITE_MARKET_DEFAULT_CURRENCY || 'sat'
}
// OBSOLETE: nostrclient config is never consumed in the codebase
// nostrclient: {
// url: import.meta.env.VITE_NOSTRCLIENT_URL || 'wss://localhost:5000/nostrclient/api/v1',
// enabled: Boolean(import.meta.env.VITE_NOSTRCLIENT_ENABLED)
// },
// OBSOLETE: support config is never consumed in the codebase
// support: {
// npub: import.meta.env.VITE_SUPPORT_NPUB || ''
// }
} as const
// Debug logging

View file

@ -136,7 +136,7 @@ export class WalletWebSocketService extends BaseService {
this.disconnect()
// Build WebSocket URL
const baseUrl = import.meta.env.VITE_LNBITS_BASE_URL || import.meta.env.VITE_API_BASE_URL || 'http://localhost:5000'
const baseUrl = import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000'
const wsProtocol = baseUrl.startsWith('https') ? 'wss:' : 'ws:'
const host = baseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '')
const wsUrl = `${wsProtocol}//${host}/api/v1/ws/${walletInkey}`
@ -578,7 +578,7 @@ export class WalletWebSocketService extends BaseService {
}
// Fetch balance from LNbits API
const baseUrl = import.meta.env.VITE_LNBITS_BASE_URL || import.meta.env.VITE_API_BASE_URL || 'http://localhost:5000'
const baseUrl = import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000'
const response = await fetch(`${baseUrl}/api/v1/wallet`, {
headers: {
'X-Api-Key': wallet.inkey