From 6e35d293c0957f6f8a3ba9d0110e8071f71e62e5 Mon Sep 17 00:00:00 2001 From: Dennis Kliban Date: Mon, 16 Dec 2024 16:10:17 -0500 Subject: [PATCH] Makes CONTENT_ORIGIN not a required setting --- CHANGES/5931.feature | 1 + docs/admin/reference/settings.md | 8 ++++---- pulpcore/app/checks.py | 15 --------------- pulpcore/app/settings.py | 3 +-- 4 files changed, 6 insertions(+), 21 deletions(-) create mode 100644 CHANGES/5931.feature diff --git a/CHANGES/5931.feature b/CHANGES/5931.feature new file mode 100644 index 0000000000..755129d8d0 --- /dev/null +++ b/CHANGES/5931.feature @@ -0,0 +1 @@ +Allow CONTENT_ORIGIN to be None. When None, the base_url for Distributions is a relative path. diff --git a/docs/admin/reference/settings.md b/docs/admin/reference/settings.md index 6efffd6cd2..a706800c77 100644 --- a/docs/admin/reference/settings.md +++ b/docs/admin/reference/settings.md @@ -1,10 +1,9 @@ # Settings -There are only two required settings, although specific plugins may have additional required +There is one required settings, although specific plugins may have additional required settings. - `SECRET_KEY ` -- `CONTENT_ORIGIN ` !!! note For more information on how to specify settings see the [`Applying Settings`](#). @@ -197,10 +196,11 @@ this setting only applies to uploads created after the change. ### CONTENT_ORIGIN -A required string containing the protocol, fqdn, and port where the content app is reachable by +A string containing the protocol, fqdn, and port where the content app is reachable by users. This is used by `pulpcore` and various plugins when referring users to the content app. For example if the API should refer users to content at using http to pulp.example.com on port -24816, (the content default port), you would set: `https://pulp.example.com:24816`. +24816, (the content default port), you would set: `http://pulp.example.com:24816`. The default is +`None`. When set to `None`, the API returns relative URLs (without the protocol, fqdn, and port). ### HIDE_GUARDED_DISTRIBUTIONS diff --git a/pulpcore/app/checks.py b/pulpcore/app/checks.py index a0129bf56b..77457b020f 100644 --- a/pulpcore/app/checks.py +++ b/pulpcore/app/checks.py @@ -4,21 +4,6 @@ from django.core.checks import Error as CheckError, Warning as CheckWarning, register -@register(deploy=True) -def content_origin_check(app_configs, **kwargs): - messages = [] - if getattr(settings, "CONTENT_ORIGIN", "UNREACHABLE") == "UNREACHABLE": - messages.append( - CheckError( - "CONTENT_ORIGIN is a required setting but it was not configured. This may be " - "caused by invalid read permissions of the settings file. Note that " - "CONTENT_ORIGIN is set by the installation automatically.", - id="pulpcore.E001", - ) - ) - return messages - - @register(deploy=True) def secret_key_check(app_configs, **kwargs): messages = [] diff --git a/pulpcore/app/settings.py b/pulpcore/app/settings.py index ac42609145..c50225c037 100644 --- a/pulpcore/app/settings.py +++ b/pulpcore/app/settings.py @@ -262,8 +262,7 @@ DRF_ACCESS_POLICY = {"reusable_conditions": ["pulpcore.app.global_access_conditions"]} -# This is a sentinal value for deploy checks, since we don't want to set a default one. -CONTENT_ORIGIN = "UNREACHABLE" +CONTENT_ORIGIN = None CONTENT_PATH_PREFIX = "/pulp/content/" API_APP_TTL = 120 # The heartbeat is called from gunicorn notify (defaulting to 45 sec).