diff --git a/artefact_enumerator.py b/artefact_enumerator.py index e9851c76..0ad64251 100644 --- a/artefact_enumerator.py +++ b/artefact_enumerator.py @@ -664,7 +664,7 @@ def main(): routes=delivery.client.DeliveryServiceRoutes( base_url=delivery_service_url, ), - cfg_factory=cfg_factory, + auth_token_lookup=lookups.github_auth_token_lookup, ) component_descriptor_lookup = lookups.init_component_descriptor_lookup( diff --git a/bdba/__main__.py b/bdba/__main__.py index 974374e8..66eae22a 100644 --- a/bdba/__main__.py +++ b/bdba/__main__.py @@ -326,7 +326,7 @@ def main(): routes=delivery.client.DeliveryServiceRoutes( base_url=delivery_service_url, ), - cfg_factory=cfg_factory, + auth_token_lookup=lookups.github_auth_token_lookup, ) oci_client = lookups.semver_sanitising_oci_client( diff --git a/delivery_db_backup.py b/delivery_db_backup.py index fcca30c0..285446fa 100644 --- a/delivery_db_backup.py +++ b/delivery_db_backup.py @@ -341,7 +341,7 @@ def main(): routes=delivery.client.DeliveryServiceRoutes( base_url=delivery_service_url, ), - cfg_factory=cfg_factory, + auth_token_lookup=lookups.github_auth_token_lookup, ) greatest_versions = delivery_service_client.greatest_component_versions( diff --git a/issue_replicator/__main__.py b/issue_replicator/__main__.py index a561763a..d3f0bb80 100644 --- a/issue_replicator/__main__.py +++ b/issue_replicator/__main__.py @@ -486,7 +486,7 @@ def main(): routes=delivery.client.DeliveryServiceRoutes( base_url=delivery_service_url, ), - cfg_factory=cfg_factory, + auth_token_lookup=lookups.github_auth_token_lookup, ) component_descriptor_lookup = lookups.init_component_descriptor_lookup( diff --git a/lookups.py b/lookups.py index 883e9b6a..c8c6c738 100644 --- a/lookups.py +++ b/lookups.py @@ -408,3 +408,18 @@ def github_repo_lookup( return gh_api.repository(org, repo) return github_repo_lookup + + +def github_auth_token_lookup(url: str, /): + ''' + an implementation of delivery.client.AuthTokenLookup + ''' + import ccc.github + import model.base + + try: + github_cfg = ccc.github.github_cfg_for_repo_url(url) + except model.base.ConfigElementNotFoundError: + return None + + return github_cfg.credentials().auth_token() diff --git a/malware/__main__.py b/malware/__main__.py index 920fc6c0..c1557021 100644 --- a/malware/__main__.py +++ b/malware/__main__.py @@ -319,7 +319,7 @@ def main(): routes=delivery.client.DeliveryServiceRoutes( base_url=delivery_service_url, ), - cfg_factory=cfg_factory, + auth_token_lookup=lookups.github_auth_token_lookup, ) oci_client = lookups.semver_sanitising_oci_client(