Spaces:
Running

axeronis commited on
Commit
b39b3a3
·
1 Parent(s): 99299b2

fix: Improve Evolution API configuration check with detailed logging

Browse files
Files changed (1) hide show
  1. backend/app/services/whatsapp_qr.py +15 -3
backend/app/services/whatsapp_qr.py CHANGED
@@ -24,12 +24,24 @@ class WhatsAppQRSession:
24
 
25
  def _is_configured(self) -> bool:
26
  """Check if Evolution API is properly configured"""
27
- return (
 
28
  self.evolution_url and
29
- self.evolution_url != 'http://localhost:8080' and
 
 
30
  self.evolution_api_key and
31
- self.evolution_api_key != 'your-api-key'
32
  )
 
 
 
 
 
 
 
 
 
33
 
34
  def _get_headers(self) -> Dict[str, str]:
35
  """Get Evolution API headers"""
 
24
 
25
  def _is_configured(self) -> bool:
26
  """Check if Evolution API is properly configured"""
27
+ # Check if both URL and API key are set and not default values
28
+ has_url = (
29
  self.evolution_url and
30
+ self.evolution_url not in ['http://localhost:8080', 'localhost:8080', '']
31
+ )
32
+ has_key = (
33
  self.evolution_api_key and
34
+ self.evolution_api_key not in ['your-api-key', '']
35
  )
36
+
37
+ if not has_url or not has_key:
38
+ logger.warning(
39
+ f"Evolution API not configured: "
40
+ f"URL={self.evolution_url}, "
41
+ f"has_key={bool(self.evolution_api_key)}"
42
+ )
43
+
44
+ return has_url and has_key
45
 
46
  def _get_headers(self) -> Dict[str, str]:
47
  """Get Evolution API headers"""