This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new 8630507  Fix some problems with looking up secret configuration values
8630507 is described below

commit 86305077f486030fae98879d1fde800502f56cfc
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Jan 19 16:46:17 2026 +0000

    Fix some problems with looking up secret configuration values
---
 atr/config.py | 9 ++++++++-
 atr/server.py | 5 +++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/atr/config.py b/atr/config.py
index 5c30913..4430757 100644
--- a/atr/config.py
+++ b/atr/config.py
@@ -33,13 +33,20 @@ def _config_secrets(key: str, state_dir: str, default: str 
| None = None, cast:
         repo_ini = decouple.RepositoryIni(secrets_path)
         config_obj = decouple.Config(repo_ini)
         sentinel = object()
-        value = config_obj.get(key, default=sentinel, cast=cast)
+        # Using a cast here would also cast the default sentinel value
+        value = config_obj.get(key, default=sentinel)
         if value is sentinel:
+            if default is None:
+                # We must return None separately because otherwise it may be 
cast
+                return decouple.config(key, default=None)
             return decouple.config(key, default=default, cast=cast)
         if isinstance(value, str) or (value is None):
             return value
         return None
     except FileNotFoundError:
+        if default is None:
+            # We must return None separately because otherwise it may be cast
+            return decouple.config(key, default=None)
         return decouple.config(key, default=default, cast=cast)
 
 
diff --git a/atr/server.py b/atr/server.py
index b602361..fc3e4fe 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -121,7 +121,12 @@ def _app_create_base(app_config: type[config.AppConfig]) 
-> base.QuartApp:
     if asfquart.construct is ...:
         raise ValueError("asfquart.construct is not set")
     app = asfquart.construct(__name__)
+    # ASFQuart sets secret_key from apptoken.txt, or generates a new one
+    # We must preserve this because from_object will overwrite it
+    # Our AppConfig.SECRET_KEY is None since we no longer support that setting
+    asfquart_secret_key = app.secret_key
     app.config.from_object(app_config)
+    app.secret_key = asfquart_secret_key
     return app
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to