feat: Add debug logging for LNBits API and configuration
- Introduce console logging for LNBits API requests, providing visibility into endpoint calls and full URLs. - Add debug logging for configuration loading, displaying key configuration values while masking sensitive information. - Enhance overall debugging capabilities to facilitate easier troubleshooting and monitoring of API interactions.
This commit is contained in:
parent
7d7bee8e77
commit
59e0496ad9
3 changed files with 21 additions and 5 deletions
|
|
@ -75,6 +75,8 @@ class LnbitsAPI {
|
||||||
options: RequestInit = {}
|
options: RequestInit = {}
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const url = getApiUrl(endpoint)
|
const url = getApiUrl(endpoint)
|
||||||
|
console.log('🔧 LNBits API request:', { endpoint, fullUrl: url })
|
||||||
|
|
||||||
const headers: HeadersInit = {
|
const headers: HeadersInit = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
...options.headers,
|
...options.headers,
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,13 @@ export const config: AppConfig = {
|
||||||
}
|
}
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
|
// Debug logging
|
||||||
|
console.log('🔧 Config loaded:', {
|
||||||
|
VITE_LNBITS_BASE_URL: import.meta.env.VITE_LNBITS_BASE_URL,
|
||||||
|
apiBaseUrl: config.api.baseUrl,
|
||||||
|
apiKey: config.api.key ? '***' : 'not set'
|
||||||
|
})
|
||||||
|
|
||||||
// Utility functions for common config operations
|
// Utility functions for common config operations
|
||||||
export const configUtils = {
|
export const configUtils = {
|
||||||
isAdminPubkey: (pubkey: string): boolean => {
|
isAdminPubkey: (pubkey: string): boolean => {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,13 @@ export const LNBITS_CONFIG = {
|
||||||
USER_STORAGE_KEY: 'lnbits_user_data'
|
USER_STORAGE_KEY: 'lnbits_user_data'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug logging
|
||||||
|
console.log('🔧 LNBits Config loaded:', {
|
||||||
|
VITE_LNBITS_BASE_URL: import.meta.env.VITE_LNBITS_BASE_URL,
|
||||||
|
API_BASE_URL: LNBITS_CONFIG.API_BASE_URL,
|
||||||
|
DEBUG: LNBITS_CONFIG.DEBUG
|
||||||
|
})
|
||||||
|
|
||||||
// Helper function to get the full API URL
|
// Helper function to get the full API URL
|
||||||
export function getApiUrl(endpoint: string): string {
|
export function getApiUrl(endpoint: string): string {
|
||||||
return `${LNBITS_CONFIG.API_BASE_URL}${endpoint}`
|
return `${LNBITS_CONFIG.API_BASE_URL}${endpoint}`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue