Parameterize bitwarden_collection_id (#520)

This commit is contained in:
Kerem Yilmaz 2024-06-26 08:55:48 -07:00 committed by GitHub
parent 0031e6b470
commit 8155be9ff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,13 +151,22 @@ class WorkflowRunContext:
LOG.error(f"URL parameter {parameter.url_parameter_key} not found or has no value") LOG.error(f"URL parameter {parameter.url_parameter_key} not found or has no value")
raise ValueError("URL parameter for Bitwarden login credentials not found or has no value") raise ValueError("URL parameter for Bitwarden login credentials not found or has no value")
collection_id = None
if parameter.bitwarden_collection_id:
if self.has_parameter(parameter.bitwarden_collection_id) and self.has_value(
parameter.bitwarden_collection_id
):
collection_id = self.values[parameter.bitwarden_collection_id]
else:
collection_id = parameter.bitwarden_collection_id
try: try:
secret_credentials = BitwardenService.get_secret_value_from_url( secret_credentials = BitwardenService.get_secret_value_from_url(
client_id, client_id,
client_secret, client_secret,
master_password, master_password,
url, url,
collection_id=parameter.bitwarden_collection_id, collection_id=collection_id,
) )
if secret_credentials: if secret_credentials:
self.secrets[BitwardenConstants.URL] = url self.secrets[BitwardenConstants.URL] = url