Skip to content

Commit

Permalink
Add setting to toggle tuf
Browse files Browse the repository at this point in the history
- disable by default
- enable in dev environment

Signed-off-by: Lukas Puehringer <[email protected]>
  • Loading branch information
lukpueh committed Apr 19, 2024
1 parent dac152b commit ede9c1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/environment
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ TWOFACTORMANDATE_ENABLED=true
OIDC_AUDIENCE=pypi

TUF_RSTUF_API_URL="http://rstuf-api"
TUF_ENABLED=true

# Default to the reCAPTCHA testing keys from https://developers.google.com/recaptcha/docs/faq
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
Expand Down
7 changes: 7 additions & 0 deletions warehouse/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ def configure(settings=None):
"OIDC_BACKEND",
default="warehouse.oidc.services.OIDCPublisherService",
)
maybe_set(
settings,
"tuf.enabled",
"TUF_ENABLED",
coercer=distutils.util.strtobool,
default=False,
)
maybe_set(settings, "tuf.rstuf_api_url", "TUF_RSTUF_API_URL")

# Pythondotorg integration settings
Expand Down
3 changes: 3 additions & 0 deletions warehouse/tuf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def update_metadata(request: Request, project: Project):
distributions files and simple detail files. In reality, simple detail files
are enough, as they already include all relevant distribution file infos.
"""
if not request.registry.settings["tuf.enabled"]:
return

digest, path, size = render_simple_detail(project, request, store=True)

server = request.registry.settings["tuf.rstuf_api_url"]
Expand Down

0 comments on commit ede9c1a

Please sign in to comment.