Skip to content

Commit f701be4

Browse files
committed
feat(chat): support CHERRY_PROJECT_KEY in settings and views for room creation
1 parent a2e8f63 commit f701be4

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

backend/NextVibeAPI/NextVibeAPI/setting/dev.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,5 @@
310310
# Cherry Chat
311311
CHERRY_APP_ID = os.getenv("CHERRY_APP_ID", "16e14376-0fce-4536-8891-754fd8fb5748")
312312
CHERRY_APP_SECRET = os.getenv("CHERRY_APP_SECRET", "")
313+
CHERRY_PROJECT_KEY = os.getenv("CHERRY_PROJECT_KEY", "")
313314

backend/NextVibeAPI/NextVibeAPI/setting/prod.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,4 @@
324324
# Cherry Chat
325325
CHERRY_APP_ID = os.getenv("CHERRY_APP_ID", "16e14376-0fce-4536-8891-754fd8fb5748")
326326
CHERRY_APP_SECRET = os.getenv("CHERRY_APP_SECRET", "")
327+
CHERRY_PROJECT_KEY = os.getenv("CHERRY_PROJECT_KEY", "")

backend/NextVibeAPI/chat/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ def post(self, request):
162162

163163
app_id = getattr(settings, 'CHERRY_APP_ID', '16e14376-0fce-4536-8891-754fd8fb5748')
164164
app_secret = getattr(settings, 'CHERRY_APP_SECRET', None)
165+
project_key = getattr(settings, 'CHERRY_PROJECT_KEY', None)
165166

166167
if not app_secret:
167168
logger.error("CHERRY_APP_SECRET is not configured on the backend settings.")
@@ -198,8 +199,11 @@ def post(self, request):
198199
members.append(owner_wallet)
199200

200201
# Call Cherry API with the correct endpoint URL
202+
if not project_key:
203+
logger.warning("CHERRY_PROJECT_KEY is not configured on the backend. Group creation will likely fail.")
204+
auth_token = project_key if project_key else app_secret
201205
headers = {
202-
'Authorization': f'Bearer {app_secret}',
206+
'Authorization': f'Bearer {auth_token}',
203207
'Content-Type': 'application/json'
204208
}
205209
payload_cherry = {

0 commit comments

Comments
 (0)