forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2f4f99
commit b6f1ffc
Showing
2 changed files
with
33 additions
and
78 deletions.
There are no files selected for viewing
54 changes: 10 additions & 44 deletions
54
openedx/core/djangoapps/django_comment_common/comment_client/settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,19 @@ | ||
# lint-amnesty, pylint: disable=cyclic-import, missing-module-docstring | ||
from django.conf import settings | ||
|
||
if hasattr(settings, "COMMENTS_SERVICE_URL"): | ||
SERVICE_HOST = settings.COMMENTS_SERVICE_URL | ||
else: | ||
SERVICE_HOST = "http://localhost:4567" | ||
|
||
PREFIX = SERVICE_HOST + "/api/v1" | ||
|
||
# V2 url support for differential logging | ||
if hasattr(settings, "COMMENTS_SERVICE_V2_URL"): | ||
SERVICE_HOST_V2 = settings.COMMENTS_SERVICE_V2_URL | ||
if hasattr(settings, "FORUM_V2_SERVICE_URL"): | ||
SERVICE_HOST = settings.FORUM_V2_SERVICE_URL | ||
else: | ||
SERVICE_HOST_V2 = "http://localhost:8000" | ||
SERVICE_HOST = "http://localhost:8000" | ||
|
||
PREFIX_V2 = SERVICE_HOST_V2 + "/forum/api/v2" | ||
PROXY_PREFIX_V2 = SERVICE_HOST_V2 + "/forum/forum_proxy/api/v1" | ||
PREFIX = SERVICE_HOST + "/forum/api/v2" | ||
|
||
""" | ||
This setting is intended to help route traffic to the appropriate version of the Forum API based on the structure of the URL. | ||
|
||
FORUM_V2_REGEXS contains regex patterns for matching ForumV2 app URLs. | ||
The application will use the ForumV2 APIs if a ForumV1 URL matches any of these regex patterns. | ||
The dictionary keys represent the HTTP methods and the values are lists of | ||
regex patternsthat correspond to the endpoints for each method. | ||
# FORUM V1 SERVICE HOST | ||
if hasattr(settings, "COMMENTS_SERVICE_URL"): | ||
COMMENTS_SERVICE_SERVICE_HOST = settings.COMMENTS_SERVICE_URL | ||
else: | ||
COMMENTS_SERVICE_SERVICE_HOST = "http://localhost:4567" | ||
|
||
Example: | ||
FORUM_V2_REGEXS = { | ||
"put": [ | ||
"^/threads/([a-zA-Z0-9]+)/votes$", | ||
# Example regex for PUT requests to update votes for a specific thread. | ||
], | ||
"delete": [ | ||
"^/threads/([a-zA-Z0-9]+)/votes$", | ||
# Example regex for DELETE requests to remove votes for a specific thread. | ||
], | ||
"post": [ | ||
# Add regex patterns for POST requests here. | ||
], | ||
"get": [ | ||
# Add regex patterns for GET requests here. | ||
], | ||
} | ||
""" | ||
COMMENTS_SERVICE_PREFIX = COMMENTS_SERVICE_SERVICE_HOST + "/api/v1" | ||
|
||
FORUM_V2_REGEXS = { | ||
"put": [], | ||
"delete": [], | ||
"post": [], | ||
"get": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters