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:
parent
3d69cfa15d
commit
4a95258acf
3 changed files with 42 additions and 25 deletions
17
.env.example
17
.env.example
|
|
@ -1,3 +1,6 @@
|
||||||
|
# App Configuration
|
||||||
|
VITE_APP_NAME=MyApp
|
||||||
|
|
||||||
# Nostr Configuration
|
# Nostr Configuration
|
||||||
VITE_NOSTR_RELAYS=["wss://relay.damus.io","wss://relay.snort.social"]
|
VITE_NOSTR_RELAYS=["wss://relay.damus.io","wss://relay.snort.social"]
|
||||||
VITE_ADMIN_PUBKEYS=["your-admin-pubkey-here"]
|
VITE_ADMIN_PUBKEYS=["your-admin-pubkey-here"]
|
||||||
|
|
@ -5,6 +8,8 @@ VITE_ADMIN_PUBKEYS=["your-admin-pubkey-here"]
|
||||||
# API Configuration
|
# API Configuration
|
||||||
VITE_LNBITS_BASE_URL=http://localhost:5000
|
VITE_LNBITS_BASE_URL=http://localhost:5000
|
||||||
VITE_API_KEY=your-api-key-here
|
VITE_API_KEY=your-api-key-here
|
||||||
|
VITE_LNBITS_DEBUG=false
|
||||||
|
VITE_WEBSOCKET_ENABLED=true
|
||||||
|
|
||||||
# Lightning Address Domain (optional)
|
# Lightning Address Domain (optional)
|
||||||
# Override the domain used for Lightning Addresses
|
# Override the domain used for Lightning Addresses
|
||||||
|
|
@ -17,13 +22,17 @@ VITE_VAPID_PUBLIC_KEY=your-vapid-public-key
|
||||||
VITE_PUSH_NOTIFICATIONS_ENABLED=true
|
VITE_PUSH_NOTIFICATIONS_ENABLED=true
|
||||||
|
|
||||||
# Support
|
# 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)
|
# Image Upload Configuration (pict-rs)
|
||||||
VITE_PICTRS_BASE_URL=https://img.mydomain.com
|
VITE_PICTRS_BASE_URL=https://img.mydomain.com
|
||||||
|
|
||||||
# Market Configuration
|
# Market Configuration
|
||||||
VITE_MARKET_NADDR=naddr1qqjxgdp4vv6rydej943n2dny956rwwf4943xzwfc95ekyd3evenrsvrrvc6r2qf8waehxw309akxucnfw3ejuct5d96xcctw9e5k7tmwdaehgunjv4kxz7f0v96xjmczyqrfrfkxv3m8t4elpe28x065z30zszaaqa4u0744qcmadsz3y50cjqcyqqq82scmcafla
|
VITE_MARKET_NADDR=naddr1qqjxgdp4vv6rydej943n2dny956rwwf4943xzwfc95ekyd3evenrsvrrvc6r2qf8waehxw309akxucnfw3ejuct5d96xcctw9e5k7tmwdaehgunjv4kxz7f0v96xjmczyqrfrfkxv3m8t4elpe28x065z30zszaaqa4u0744qcmadsz3y50cjqcyqqq82scmcafla
|
||||||
VITE_MARKET_RELAYS=["wss://relay.damus.io","wss://relay.snort.social","wss://nostr-pub.wellorder.net"]
|
# OBSOLETE: Not used in codebase - market uses VITE_NOSTR_RELAYS instead
|
||||||
VITE_LIGHTNING_ENABLED=true
|
# VITE_MARKET_RELAYS=["wss://relay.damus.io","wss://relay.snort.social","wss://nostr-pub.wellorder.net"]
|
||||||
VITE_MARKET_DEFAULT_CURRENCY=sat
|
# 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
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,10 @@ interface PushConfig {
|
||||||
|
|
||||||
interface MarketConfig {
|
interface MarketConfig {
|
||||||
defaultNaddr: string
|
defaultNaddr: string
|
||||||
lightningEnabled: boolean
|
// OBSOLETE: lightningEnabled is never consumed in the codebase
|
||||||
defaultCurrency: string
|
// lightningEnabled: boolean
|
||||||
|
// OBSOLETE: defaultCurrency is never consumed in the codebase
|
||||||
|
// defaultCurrency: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AppConfig {
|
interface AppConfig {
|
||||||
|
|
@ -28,13 +30,15 @@ interface AppConfig {
|
||||||
api: ApiConfig
|
api: ApiConfig
|
||||||
push: PushConfig
|
push: PushConfig
|
||||||
market: MarketConfig
|
market: MarketConfig
|
||||||
nostrclient: {
|
// OBSOLETE: nostrclient config is never consumed in the codebase
|
||||||
url: string
|
// nostrclient: {
|
||||||
enabled: boolean
|
// url: string
|
||||||
}
|
// enabled: boolean
|
||||||
support: {
|
// }
|
||||||
npub: string
|
// OBSOLETE: support config is never consumed in the codebase
|
||||||
}
|
// support: {
|
||||||
|
// npub: string
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse JSON environment variables safely
|
// Parse JSON environment variables safely
|
||||||
|
|
@ -65,17 +69,21 @@ export const config: AppConfig = {
|
||||||
enabled: Boolean(import.meta.env.VITE_PUSH_NOTIFICATIONS_ENABLED)
|
enabled: Boolean(import.meta.env.VITE_PUSH_NOTIFICATIONS_ENABLED)
|
||||||
},
|
},
|
||||||
market: {
|
market: {
|
||||||
defaultNaddr: import.meta.env.VITE_MARKET_NADDR || '',
|
defaultNaddr: import.meta.env.VITE_MARKET_NADDR || ''
|
||||||
lightningEnabled: Boolean(import.meta.env.VITE_LIGHTNING_ENABLED),
|
// OBSOLETE: lightningEnabled is never consumed in the codebase
|
||||||
defaultCurrency: import.meta.env.VITE_MARKET_DEFAULT_CURRENCY || 'sat'
|
// lightningEnabled: Boolean(import.meta.env.VITE_LIGHTNING_ENABLED),
|
||||||
},
|
// OBSOLETE: defaultCurrency is never consumed in the codebase
|
||||||
nostrclient: {
|
// defaultCurrency: import.meta.env.VITE_MARKET_DEFAULT_CURRENCY || 'sat'
|
||||||
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 || ''
|
|
||||||
}
|
}
|
||||||
|
// 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
|
} as const
|
||||||
|
|
||||||
// Debug logging
|
// Debug logging
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export class WalletWebSocketService extends BaseService {
|
||||||
this.disconnect()
|
this.disconnect()
|
||||||
|
|
||||||
// Build WebSocket URL
|
// 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 wsProtocol = baseUrl.startsWith('https') ? 'wss:' : 'ws:'
|
||||||
const host = baseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '')
|
const host = baseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '')
|
||||||
const wsUrl = `${wsProtocol}//${host}/api/v1/ws/${walletInkey}`
|
const wsUrl = `${wsProtocol}//${host}/api/v1/ws/${walletInkey}`
|
||||||
|
|
@ -578,7 +578,7 @@ export class WalletWebSocketService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch balance from LNbits API
|
// 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`, {
|
const response = await fetch(`${baseUrl}/api/v1/wallet`, {
|
||||||
headers: {
|
headers: {
|
||||||
'X-Api-Key': wallet.inkey
|
'X-Api-Key': wallet.inkey
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue