fix sheets
Browse files- 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 |
-
|
| 97 |
-
|
| 98 |
-
'
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|