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 0cc6d63  Fix some problems with looking up secret configuration values
0cc6d63 is described below

commit 0cc6d630be70c93196934f2470e59022b0f8e9cb
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Jan 19 16:25:23 2026 +0000

    Fix some problems with looking up secret configuration values
---
 atr/config.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/atr/config.py b/atr/config.py
index 5c30913..e1878df 100644
--- a/atr/config.py
+++ b/atr/config.py
@@ -31,15 +31,18 @@ def _config_secrets(key: str, state_dir: str, default: str 
| None = None, cast:
     secrets_path = os.path.join(state_dir, "secrets.ini")
     try:
         repo_ini = decouple.RepositoryIni(secrets_path)
-        config_obj = decouple.Config(repo_ini)
-        sentinel = object()
-        value = config_obj.get(key, default=sentinel, cast=cast)
-        if value is sentinel:
+        if key not in repo_ini:
+            if default is None:
+                return decouple.config(key, default=None)
             return decouple.config(key, default=default, cast=cast)
+        config_obj = decouple.Config(repo_ini)
+        value = config_obj.get(key, cast=cast)
         if isinstance(value, str) or (value is None):
             return value
         return None
     except FileNotFoundError:
+        if default is None:
+            return decouple.config(key, default=None)
         return decouple.config(key, default=default, cast=cast)
 
 


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

Reply via email to