Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 4c41647

Browse files
fix: Handle disabled shelter (#1093)
1 parent dd38e97 commit 4c41647

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

codecov/settings_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@
395395
)
396396

397397
SHELTER_SHARED_SECRET = get_config("setup", "shelter_shared_secret", default=None)
398+
SHELTER_ENABLED = get_config("setup", "shelter_enabled", default=True)
398399

399400
SENTRY_ENV = os.environ.get("CODECOV_ENV", False)
400401
SENTRY_DSN = os.environ.get("SERVICES__SENTRY__SERVER_DSN", None)

codecov/settings_enterprise.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,5 @@
7272
]
7373

7474
GUEST_ACCESS = get_config("setup", "guest_access", default=True)
75+
76+
SHELTER_ENABLED = get_config("setup", "shelter_enabled", default=False)

utils/shelter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def get_instance(cls) -> "ShelterPubsub":
2323
return cls._instance
2424

2525
def __init__(self) -> None:
26+
if not settings.SHELTER_ENABLED:
27+
return
28+
2629
if not self.pubsub_publisher:
2730
self.pubsub_publisher = pubsub_v1.PublisherClient()
2831
pubsub_project_id: str = settings.SHELTER_PUBSUB_PROJECT_ID
@@ -32,6 +35,9 @@ def __init__(self) -> None:
3235
self.topic_path = self.pubsub_publisher.topic_path(pubsub_project_id, topic_id)
3336

3437
def publish(self, data: Dict[str, Any]) -> None:
38+
if not settings.SHELTER_ENABLED:
39+
return
40+
3541
try:
3642
self.pubsub_publisher.publish(
3743
self.topic_path,

0 commit comments

Comments
 (0)