VietCat commited on
Commit
5e2e440
·
1 Parent(s): 8a2fdbf

fix sheets

Browse files
Files changed (1) hide show
  1. app/utils.py +17 -6
app/utils.py CHANGED
@@ -93,12 +93,23 @@ def validate_config(settings) -> None:
93
  Output: None (raise RuntimeError nếu thiếu)
94
  """
95
  missing = []
96
- for field in [
97
- 'facebook_verify_token', 'facebook_app_secret',
98
- 'google_sheets_credentials_file', 'google_sheets_token_file', 'conversation_sheet_id',
99
- 'supabase_url', 'supabase_key']:
100
- if not getattr(settings, field, None):
101
- missing.append(field)
 
 
 
 
 
 
 
 
 
 
 
102
  if missing:
103
  raise RuntimeError(f"Missing config: {', '.join(missing)}")
104
 
 
93
  Output: None (raise RuntimeError nếu thiếu)
94
  """
95
  missing = []
96
+ # Facebook
97
+ if not getattr(settings, 'facebook_verify_token', None):
98
+ missing.append('facebook_verify_token')
99
+ if not getattr(settings, 'facebook_app_secret', None):
100
+ missing.append('facebook_app_secret')
101
+ # Google Sheets: chấp nhận 1 trong 2 biến
102
+ if not (getattr(settings, 'google_sheets_credentials_file', None) or os.getenv("GOOGLE_SHEETS_CREDENTIALS_JSON")):
103
+ missing.append('google_sheets_credentials_file or GOOGLE_SHEETS_CREDENTIALS_JSON')
104
+ if not getattr(settings, 'google_sheets_token_file', None):
105
+ missing.append('google_sheets_token_file')
106
+ if not getattr(settings, 'conversation_sheet_id', None):
107
+ missing.append('conversation_sheet_id')
108
+ # Supabase
109
+ if not getattr(settings, 'supabase_url', None):
110
+ missing.append('supabase_url')
111
+ if not getattr(settings, 'supabase_key', None):
112
+ missing.append('supabase_key')
113
  if missing:
114
  raise RuntimeError(f"Missing config: {', '.join(missing)}")
115