-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow resource_link change dynamic
Remove the `RICHIE_OPENEDX_SYNC_LOG_REQUESTS` setting, it uses lazy logging. Review documentation fccn/nau-richie-site-factory#198
- Loading branch information
Showing
4 changed files
with
117 additions
and
79 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Configuration | ||
|
||
## Settings | ||
|
||
- `INSTALLED_APPS` need to include `richie_openedx_sync` to install this application | ||
- `RICHIE_OPENEDX_SYNC_COURSE_HOOKS` the most important configuration. Could be configured globally on using Django settings or per organization using multi-site site configuration. This hooks consists of a list of configurations. It is required the `secret` and `url`, the other are optional - `timeout` and `resource_link_template`. | ||
|
||
Python: | ||
```python | ||
RICHIE_OPENEDX_SYNC_COURSE_HOOKS=[ | ||
{ | ||
"secret": "changeme", | ||
"url": "http://richie.local.dev:8070/api/v1.0/course-runs-sync/", | ||
"timeout": "6", | ||
"resource_link_template": "http://{lms_domain}/courses/{course_id}/info", | ||
}, | ||
] | ||
``` | ||
|
||
JSON on site configuration: | ||
```json | ||
"RICHIE_OPENEDX_SYNC_COURSE_HOOKS": [ | ||
{ | ||
"secret": "changeme", | ||
"url": "http://richie.local.dev:8070/api/v1.0/course-runs-sync/", | ||
"timeout": "6", | ||
"resource_link_template": "http://{lms_domain}/courses/{course_id}/info" | ||
} | ||
] | ||
``` | ||
|
||
## Multi site | ||
If you have a multi site instance, you can configure a specific hook for that Organization. | ||
|
||
Example of Open edX [Site Configuration](http://localhost:18000/admin/site_configuration/siteconfiguration/1/change/) | ||
Django administration page add the next configurations: | ||
|
||
```json | ||
"RICHIE_OPENEDX_SYNC_COURSE_HOOKS": [ | ||
{ | ||
"secret": "changeme", | ||
"url": "http://richie.local.dev:8070/api/v1.0/course-runs-sync/", | ||
"timeout": "6", | ||
"resource_link_template": "http://{lms_domain}/courses/{course_id}/info" | ||
} | ||
] | ||
``` |
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
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,17 +1,7 @@ | ||
from django.conf import settings | ||
|
||
# Load `RICHIE_OPENEDX_SYNC_COURSE_HOOKS` setting using the open edX `ENV_TOKENS` production mode. | ||
# This requires the `RICHIE_OPENEDX_SYNC_COURSE_HOOKS` should be added to the `EDXAPP_ENV_EXTRA` | ||
# ansible deployment configuration. | ||
settings.RICHIE_OPENEDX_SYNC_COURSE_HOOKS = getattr(settings, "ENV_TOKENS", {}).get( | ||
"RICHIE_OPENEDX_SYNC_COURSE_HOOKS", | ||
getattr(settings, "RICHIE_OPENEDX_SYNC_COURSE_HOOKS", None), | ||
) | ||
|
||
# Load `RICHIE_OPENEDX_SYNC_LOG_REQUESTS` setting using the open edX `ENV_TOKENS` production mode. | ||
# This requires the `RICHIE_OPENEDX_SYNC_LOG_REQUESTS` should be added to the `EDXAPP_ENV_EXTRA` | ||
# ansible deployment configuration. | ||
settings.RICHIE_OPENEDX_SYNC_LOG_REQUESTS = getattr(settings, "ENV_TOKENS", {}).get( | ||
"RICHIE_OPENEDX_SYNC_LOG_REQUESTS", | ||
getattr(settings, "RICHIE_OPENEDX_SYNC_LOG_REQUESTS", False), | ||
getattr(settings, "RICHIE_OPENEDX_SYNC_COURSE_HOOKS", []), | ||
) |
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