From 3a4b8c9cc7935609c68363c358ad5294b72fa6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 20 Mar 2024 17:36:13 +0100 Subject: [PATCH] misc: always declare lingo_url if lingo is deployed (#88419) --- tests/test_hobo.py | 7 +++++++ wcs/ctl/management/commands/hobo_deploy.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/tests/test_hobo.py b/tests/test_hobo.py index 44348ceb1..b0c8ccf86 100644 --- a/tests/test_hobo.py +++ b/tests/test_hobo.py @@ -76,6 +76,12 @@ HOBO_JSON = { }, ], }, + { + 'service-id': 'lingo', + 'title': 'Lingo', + 'base_url': 'http://payment.example.net/', + 'secret_key': 'aaa', + }, ], 'profile': { 'fields': [ @@ -293,6 +299,7 @@ def test_configure_site_options(setuptest, alt_tempdir): assert pub.get_site_option('xxx', 'variables') == 'HELLO WORLD' assert pub.get_site_option('portal_agent_url', 'variables') == 'http://agents.example.net/' assert pub.get_site_option('portal_url', 'variables') == 'http://portal.example.net/' + assert pub.get_site_option('lingo_url', 'variables') == 'http://payment.example.net/' assert pub.get_site_option('test_wcs_url', 'variables') == 'http://wcs.example.net/' assert pub.get_site_option('disable_cron_jobs', 'variables') == 'True' assert pub.get_site_option('maintenance_page', 'variables') == 'True' diff --git a/wcs/ctl/management/commands/hobo_deploy.py b/wcs/ctl/management/commands/hobo_deploy.py index 0d85e94f3..56ab042a4 100644 --- a/wcs/ctl/management/commands/hobo_deploy.py +++ b/wcs/ctl/management/commands/hobo_deploy.py @@ -495,6 +495,10 @@ class Command(TenantCommand): variables['portal_user_url'] = service_url variables['portal_user_title'] = service.get('title') config.set('options', 'theme_skeleton_url', service.get('base_url') + '__skeleton__/') + + if service.get('service-id') == 'lingo': + variables['lingo_url'] = urllib.parse.urljoin(service_url, '/') + for legacy_url in service.get('legacy_urls', []): legacy_domain = urllib.parse.urlparse(legacy_url['base_url']).netloc.split(':')[0] legacy_urls[legacy_domain] = domain