raphaelauv edited a comment on issue #19251:
URL: https://github.com/apache/airflow/issues/19251#issuecomment-958992113


   my quick and dirty solution -> 
   
   ```yaml
   AIRFLOW__SECRETS__BACKEND=toto.CustomCloudSecretManagerBackend
   
AIRFLOW__SECRETS__BACKEND_KWARGS={"connections_prefix":"airflow-XXX-connection","variables_prefix":"airflow-XXX-variable","sep":"-","secret_lookup_prefix":"secret_"}
   ```
   
   ```python
   from typing import Optional
   
   from airflow.providers.google.cloud.secrets.secret_manager import 
CloudSecretManagerBackend
   
   
   class CustomCloudSecretManagerBackend(CloudSecretManagerBackend):
        def __init__(
               self,
               secret_lookup_prefix: Optional[str] = None,
               **kwargs,
       ):
           super().__init__(**kwargs)
           self.secret_lookup_prefix = secret_lookup_prefix
   
       def get_variable(self, key: str) -> Optional[str]:
           if self.variables_prefix is None:
               return None
   
           if self.secret_lookup_prefix is not None:
               if not key.startswith(self.secret_lookup_prefix):
                   return None
   
           return self._get_secret(self.variables_prefix, key)
   
   ```
   


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