You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/07/19 03:34:28 UTC

[GitHub] [airflow] uranusjr commented on issue #16952: Secrets Backend Search Path Ordering/Priority

uranusjr commented 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"]}
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org