diff --git a/config.py b/config.py index f8ea61aed..db9ae3577 100644 --- a/config.py +++ b/config.py @@ -310,6 +310,9 @@ class DefaultConfig(object): # The endpoint for the security scanner. SECURITY_SCANNER_ENDPOINT = 'http://192.168.99.101:6060' + # The number of seconds between indexing intervals in the security scanner + SECURITY_SCANNER_INDEXING_INTERVAL = 30 + # If specified, the endpoint to be used for all POST calls to the security scanner. SECURITY_SCANNER_ENDPOINT_BATCH = None diff --git a/workers/securityworker.py b/workers/securityworker.py index dfc397199..314bbe436 100644 --- a/workers/securityworker.py +++ b/workers/securityworker.py @@ -15,7 +15,7 @@ from endpoints.v2 import v2_bp BATCH_SIZE = 50 -INDEXING_INTERVAL = 30 +DEFAULT_INDEXING_INTERVAL = 30 logger = logging.getLogger(__name__) @@ -35,7 +35,8 @@ class SecurityWorker(Worker): # Get the ID of the first image we want to analyze. self._min_id = get_min_id_for_sec_scan(self._target_version) - self.add_operation(self._index_images, INDEXING_INTERVAL) + interval = app.config.get('SECURITY_SCANNER_INDEXING_INTERVAL', DEFAULT_INDEXING_INTERVAL) + self.add_operation(self._index_images, interval) else: logger.warning('Failed to validate security scan configuration')