kaxil commented on a change in pull request #9645:
URL: https://github.com/apache/airflow/pull/9645#discussion_r449663361



##########
File path: airflow/configuration.py
##########
@@ -267,17 +271,49 @@ def _get_env_var_option(self, section, key):
         env_var_cmd = env_var + '_CMD'
         if env_var_cmd in os.environ:
             # if this is a valid command key...
-            if (section, key) in self.as_command_stdout:
+            if (section, key) in self.configs_with_secret:
                 return run_command(os.environ[env_var_cmd])
 
     def _get_cmd_option(self, section, key):
         fallback_key = key + '_cmd'
         # if this is a valid command key...
-        if (section, key) in self.as_command_stdout:
+        if (section, key) in self.configs_with_secret:
             if super().has_option(section, fallback_key):
                 command = super().get(section, fallback_key)
                 return run_command(command)
 
+    @cached_property
+    def _secrets_backend_client(self):
+        if super().has_option('secrets', 'backend') is False:
+            return None
+
+        secrets_backend_cls = super().get('secrets', 'backend')
+        if not secrets_backend_cls:
+            return None
+        print("secrets_backend_cls", secrets_backend_cls)
+        secrets_backend = import_string(secrets_backend_cls)
+        if secrets_backend:
+            try:
+                alternative_secrets_config_dict = json.loads(
+                    super().get('secrets', 'backend_kwargs', fallback='{}')
+                )
+            except json.JSONDecodeError:
+                alternative_secrets_config_dict = {}
+            return secrets_backend(**alternative_secrets_config_dict)

Review comment:
       ```ini
   sql_alchemy_conn_secret = conn/sql_alchemy_conn
   ```
   should already allow that.
   
   Whatever they pass to `sql_alchemy_conn_secret` will be directly used to get 
secret




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to