From 8872e31e3045327ce85925e9dec56a63167aaf5c Mon Sep 17 00:00:00 2001
From: Jennifer Richards <jennifer@staff.ietf.org>
Date: Tue, 2 Apr 2024 11:02:45 -0300
Subject: [PATCH] ci: Get APP_API_TOKENS from env (#7271)

* ci: Get APP_API_TOKENS from env

* ci: chart fixup

* ci: Remove canned APP_API_TOKENs

(setec astronomy)
---
 helm/settings_local.py | 13 ++++++++-----
 helm/values.yaml       |  1 +
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/helm/settings_local.py b/helm/settings_local.py
index 92e7bce1a..27ac84595 100644
--- a/helm/settings_local.py
+++ b/helm/settings_local.py
@@ -3,6 +3,7 @@
 
 from base64 import b64decode
 from email.utils import parseaddr
+import json
 
 from ietf import __release_hash__
 from ietf.settings import *                                          # pyflakes:ignore
@@ -136,11 +137,11 @@ elif SERVER_MODE == "production":
         "DATATRACKER_MEETECHO_CLIENT_ID and DATATRACKER_MEETECHO_CLIENT_SECRET must be set in production"
     )
 
-APP_API_TOKENS = {
-    "ietf.api.views.directauth": ["redacted",],
-    "ietf.api.views.email_aliases": ["redacted"],
-    "ietf.api.views.active_email_list": ["redacted"],
-}
+_APP_API_TOKENS_JSON = os.environ.get("DATATRACKER_APP_API_TOKENS_JSON", None)
+if _APP_API_TOKENS_JSON is not None:
+    APP_API_TOKENS = json.loads(_APP_API_TOKENS_JSON)
+else:
+    APP_API_TOKENS = {}
 
 EMAIL_COPY_TO = ""
 
@@ -195,6 +196,8 @@ DE_GFM_BINARY = "/usr/local/bin/de-gfm"
 IDSUBMIT_IDNITS_BINARY = "/usr/local/bin/idnits"
 
 # Duplicating production cache from settings.py and using it whether we're in production mode or not
+MEMCACHED_HOST = os.environ.get("MEMCACHED_SERVICE_HOST", "127.0.0.1")
+MEMCACHED_PORT = os.environ.get("MEMCACHED_SERVICE_PORT", "11211")
 from ietf import __version__
 CACHES = {
     "default": {
diff --git a/helm/values.yaml b/helm/values.yaml
index 3eedd0e1f..d09df4d65 100644
--- a/helm/values.yaml
+++ b/helm/values.yaml
@@ -593,3 +593,4 @@ env:
   # DATATRACKER_MATOMO_SITE_ID: "7"  # must be present to enable Matomo
   # DATATRACKER_MATOMO_DOMAIN_PATH: "analytics.ietf.org"
   CELERY_PASSWORD: "this-is-a-secret"
+  # DATATRACKER_APP_API_TOKENS_JSON: "<JSON blob>"