uranusjr edited a comment on issue #16952:
URL: https://github.com/apache/airflow/issues/16952#issuecomment-882207637


   Maybe we should ship a secret backend implementation that allows the user to 
pass multiple secret backends and search them in that order? Something like:
   
   ```python
   class AggregatedBackend(BaseSecretsBackend):
       def __init__(self, backends: List[str]) -> None:
           super().__init__()
           self._backends = [get_function_from_name(name) for name in backends]
   
       def get_variable(self, key: str) -> Optional[str]:
           for backend in self._backends:
               if (value := backend.get_variable(key)) is not None:
                   return value
   ```
   
   This way the user can do something like
   
   ```ini
   [secrets]
   backend = airflow.secrets.aggregated.AggregatedBackend
   backend_kwargs = {"backends": 
["airflow.secrets.environment_variables.EnvironmentVariablesBackend", 
"my_backend.MyBackend", "airflow.secrets.metastore.MetastoreBackend"]}
   ```
   
   We could even introduce some shorthands like 
`airflow.EnvironmentVariablesBackend`.


-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to