Skip to content

Commit

Permalink
Fix plugin defaults overriding user settings
Browse files Browse the repository at this point in the history
(cherry picked from commit 2094b79)
  • Loading branch information
gerrod3 committed Feb 28, 2025
1 parent b42125c commit b9ca66a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/+default-plugin-settings.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed plugin default settings overriding user settings.
6 changes: 5 additions & 1 deletion pulpcore/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,16 @@ def otel_middleware_hook(settings):

# Select enabled plugins and load their settings.
enabled_plugins = settings.get("ENABLED_PLUGINS", None)
plugin_settings = []
for entry_point in entry_points(group="pulpcore.plugin"):
if enabled_plugins and entry_point.name not in enabled_plugins:
continue
if (plugin_app := entry_point.load()) not in settings.INSTALLED_APPS:
settings.load_file(f"{entry_point.module}.app.settings")
plugin_settings.append(f"{entry_point.module}.app.settings")
settings.INSTALLED_APPS += [plugin_app]
# Ensure the plugin defaults are loaded before user configs
settings.PRELOAD_FOR_DYNACONF = plugin_settings
settings.reload()
INSTALLED_APPS = settings.INSTALLED_APPS

# begin compatibility layer for DEFAULT_FILE_STORAGE
Expand Down

0 comments on commit b9ca66a

Please # to comment.