Skip to content

Commit

Permalink
feat(secrets): DEBUG-only route reads a test secret
Browse files Browse the repository at this point in the history
the secret does not contain any sensitive information
and is only configured in the dev environment
  • Loading branch information
thekaveman committed Feb 2, 2024
1 parent d5125e4 commit 259bac6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions benefits/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging

from django.conf import settings
from django.http import HttpResponse
from django.urls import include, path

logger = logging.getLogger(__name__)
Expand All @@ -34,6 +35,18 @@ def trigger_error(request):

urlpatterns.append(path("error/", trigger_error))

# simple route to read a pre-defined "secret"
# this "secret" does not contain sensitive information
# and is only configured in the dev environment for testing/debugging

def test_secret(request):
from benefits.secrets import get_secret_by_name

return HttpResponse(get_secret_by_name("testsecret"))

urlpatterns.append(path("testsecret/", test_secret))


if settings.ADMIN:
from django.contrib import admin

Expand Down

0 comments on commit 259bac6

Please sign in to comment.