Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion openstax/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
'oxauth',
'webinars',
'donations',
'wagtailimportexport',
'wagtail_transfer',
'versions',
'oxmenus',
# wagtail
Expand All @@ -270,6 +270,47 @@
'wagtail.contrib.settings',
]

####################
# Wagtail Transfer #
####################

WAGTAILTRANSFER_SECRET_KEY = os.getenv('WAGTAILTRANSFER_SECRET_KEY', 'change-me-in-production')
Comment thread
mwvolo marked this conversation as resolved.
if ENVIRONMENT != 'local' and WAGTAILTRANSFER_SECRET_KEY == 'change-me-in-production':
raise RuntimeError(
"WAGTAILTRANSFER_SECRET_KEY must be set to a secure value in non-local environments. "
"Current value is the insecure default placeholder."
)

# Configure sources to import content from.
# Each environment should define the sources it can pull from.
# Example: on prod, you might pull from staging; on local, from staging or prod.
# Override in environment-specific settings or via env vars.
WAGTAILTRANSFER_SOURCES = {}

_transfer_source_name = os.getenv('WAGTAILTRANSFER_SOURCE_NAME')
_transfer_source_url = os.getenv('WAGTAILTRANSFER_SOURCE_URL')
_transfer_source_key = os.getenv('WAGTAILTRANSFER_SOURCE_KEY')
Comment thread
mwvolo marked this conversation as resolved.
_transfer_vars = {
'WAGTAILTRANSFER_SOURCE_NAME': _transfer_source_name,
'WAGTAILTRANSFER_SOURCE_URL': _transfer_source_url,
'WAGTAILTRANSFER_SOURCE_KEY': _transfer_source_key,
}
_set_vars = {name for name, value in _transfer_vars.items() if value}
if _set_vars and len(_set_vars) != len(_transfer_vars):
missing = sorted(set(_transfer_vars.keys()) - _set_vars)
raise RuntimeError(
"Invalid Wagtail Transfer source configuration: "
"the environment variables WAGTAILTRANSFER_SOURCE_NAME, "
"WAGTAILTRANSFER_SOURCE_URL, and WAGTAILTRANSFER_SOURCE_KEY "
"must either all be set or all be unset. "
f"Currently missing: {', '.join(missing)}."
)
if _transfer_source_name and _transfer_source_url and _transfer_source_key:
WAGTAILTRANSFER_SOURCES[_transfer_source_name] = {
'BASE_URL': _transfer_source_url,
'SECRET_KEY': _transfer_source_key,
}

########
# Cron #
########
Expand Down
3 changes: 3 additions & 0 deletions openstax/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from wagtail.admin import urls as wagtailadmin_urls
from wagtailautocomplete.urls.admin import urlpatterns as autocomplete_admin_urls
from wagtail import urls as wagtail_urls
from wagtail_transfer import urls as wagtailtransfer_urls
from wagtail.documents import urls as wagtaildocs_urls
from accounts import urls as accounts_urls

Expand Down Expand Up @@ -48,6 +49,8 @@
path('apps/cms/api/spike/', include(wagtail_urls)),
path('sitemap.xml', sitemap),

path('wagtail-transfer/', include(wagtailtransfer_urls)),

# For anything not caught by a more specific rule above, hand over to Wagtail's serving mechanism
path('', include(wagtail_urls)),
]
Expand Down
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ vcrpy==7.0.0
wagtail==7.3.1
wagtail-autocomplete==0.12.0
wagtail-modeladmin==2.2.0
wagtail-transfer==0.11
whitenoise==6.9.0
1 change: 0 additions & 1 deletion wagtailimportexport/__init__.py

This file was deleted.

11 changes: 0 additions & 11 deletions wagtailimportexport/admin_urls.py

This file was deleted.

8 changes: 0 additions & 8 deletions wagtailimportexport/apps.py

This file was deleted.

3 changes: 0 additions & 3 deletions wagtailimportexport/config.py

This file was deleted.

189 changes: 0 additions & 189 deletions wagtailimportexport/exporting.py

This file was deleted.

96 changes: 0 additions & 96 deletions wagtailimportexport/forms.py

This file was deleted.

Loading