Skip to content

Commit

Permalink
Reference delivery-service url in clamav-cfg
Browse files Browse the repository at this point in the history
Required to resolve component-descriptors.
  • Loading branch information
zkdev committed Apr 12, 2024
1 parent 0032775 commit c030369
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ class ArtefactEnumeratorConfig:
@dataclasses.dataclass(frozen=True)
class ClamAVConfig:
'''
:param str delivery_service_url
:param int lookup_new_backlog_item_interval:
time to wait in case no backlog item was found before searching for new backlog item again
:param int virus_db_max_age_days
age in days an existing scan has to exceed to trigger rescan
:param str aws_cfg_name
cfg-element used to create s3 client to retrieve artefacts
'''
delivery_service_url: str
lookup_new_backlog_item_interval: int
virus_db_max_age_days: int
aws_cfg_name: str
Expand Down Expand Up @@ -345,6 +347,12 @@ def deserialise_clamav_config(
if not clamav_config:
return

delivery_service_url = deserialise_config_property(
config=clamav_config,
property_key='delivery_service_url',
default_config=default_config,
)

lookup_new_backlog_item_interval = deserialise_config_property(
config=clamav_config,
property_key='lookup_new_backlog_item_interval',
Expand All @@ -367,6 +375,7 @@ def deserialise_clamav_config(
)

return ClamAVConfig(
delivery_service_url=delivery_service_url,
lookup_new_backlog_item_interval=lookup_new_backlog_item_interval,
virus_db_max_age_days=virus_db_max_age_days,
aws_cfg_name=aws_cfg_name,
Expand Down
3 changes: 3 additions & 0 deletions malware/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ def main():
kubernetes_api=kubernetes_api,
)

if not delivery_service_url:
delivery_service_url = clamav_config.delivery_service_url

delivery_client = delivery.client.DeliveryServiceClient(
routes=delivery.client.DeliveryServiceRoutes(
base_url=delivery_service_url,
Expand Down

0 comments on commit c030369

Please sign in to comment.