pulp / pulp/pulpcore

As a plugin developer I need configurable MIDDLEWARE list setting

Open
#1,881 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature
Dominant language
Python
Stars
598
Forks
168
Avg merge
1d 4h
Merged PRs (30d)
86

Description

Author: osapryki (osapryki)

Redmine Issue: 6467, https://pulp.plan.io/issues/6467


In actual pulp implementation it is only possible to append values to MIDDLEWARE django setting or completely overriding it.

In some cases inserting value at the beginning of the MIDDLEWARE list may be required. An example of such case is using django_prometheus for adding prometheus metrics endpoint. This plugins requires inserting one middleware class to the beginning of MIDDLEWARE list and second one to the end.

Unfortunately this is not possible without completely overriding MIDDLEWARE list with custom list that has to include all middleware classes copied from pulpcore settings. It may lead to issues in case when the default list in pulpcore repository is updated and has to be synchronized with all plugins that override it in such way.

Propositions:

  1. Move contents of MIDDLEWARE list to DEFAULT_MIDDLEWARE and move it to module default_settings.py, and make it importable and therefore re-usable by plugin developers.

  2. Provide some sort of hooks to inject values to MIDDLEWARE list, for example but not necessary based on plugin entry_points.

MIDDLEWARE may be not the only parameter that requires such customization in future, generic approach to this problem may be useful for long term.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the MIDDLEWARE setting and the proposed default_settings.py location. Compare the two suggested approaches—an importable DEFAULT_MIDDLEWARE or injection hooks such as entry_points—and determine which provides safe plugin customization without copying pulpcore defaults. Done should include an agreed generic approach and coverage for middleware configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.