Skip to content

Commit 1da891e

Browse files
ref: remove unused SENTRY_PUBLIC / SENTRY_PUBLIC_ENDPOINT
1 parent fd5eb0f commit 1da891e

File tree

7 files changed

+12
-35
lines changed

7 files changed

+12
-35
lines changed

Diff for: src/sentry/conf/server.py

-4
Original file line numberDiff line numberDiff line change
@@ -1584,9 +1584,6 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
15841584
# Should we send the beacon to the upstream server?
15851585
SENTRY_BEACON = True
15861586

1587-
# Allow access to Sentry without authentication.
1588-
SENTRY_PUBLIC = False
1589-
15901587
# Instruct Sentry that this install intends to be run by a single organization
15911588
# and thus various UI optimizations should be enabled.
15921589
SENTRY_SINGLE_ORGANIZATION = False
@@ -1879,7 +1876,6 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
18791876
# URI Prefixes for generating DSN URLs
18801877
# (Defaults to URL_PREFIX by default)
18811878
SENTRY_ENDPOINT: str | None = None
1882-
SENTRY_PUBLIC_ENDPOINT: str | None = None
18831879

18841880
# Hostname prefix to add for organizations that are opted into the
18851881
# `organizations:org-ingest-subdomains` feature.

Diff for: src/sentry/models/organization.py

-6
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ def get_for_user(self, user, scope=None, only_visible=True):
112112
if not user.is_authenticated:
113113
return []
114114

115-
if settings.SENTRY_PUBLIC and scope is None:
116-
if only_visible:
117-
return list(self.filter(status=OrganizationStatus.ACTIVE))
118-
else:
119-
return list(self.filter())
120-
121115
qs = OrganizationMember.objects.filter(user_id=user.id).select_related("organization")
122116
if only_visible:
123117
qs = qs.filter(organization__status=OrganizationStatus.ACTIVE)

Diff for: src/sentry/models/projectkey.py

+9-12
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def save(self, *args, **kwargs):
199199
super().save(*args, **kwargs)
200200

201201
def get_dsn(self, domain=None, secure=True, public=False):
202-
urlparts = urlparse(self.get_endpoint(public=public))
202+
urlparts = urlparse(self.get_endpoint())
203203

204204
if not public:
205205
key = f"{self.public_key}:{self.secret_key}"
@@ -277,27 +277,24 @@ def js_sdk_loader_cdn_url(self) -> str:
277277
reverse("sentry-js-sdk-loader", args=[self.public_key, ".min"]),
278278
)
279279

280-
def get_endpoint(self, public=True):
280+
def get_endpoint(self) -> str:
281281
from sentry.api.utils import generate_region_url
282282

283-
if public:
284-
endpoint = settings.SENTRY_PUBLIC_ENDPOINT or settings.SENTRY_ENDPOINT
285-
else:
286-
endpoint = settings.SENTRY_ENDPOINT
287-
288-
if not endpoint and SiloMode.get_current_mode() == SiloMode.REGION:
289-
endpoint = generate_region_url()
283+
endpoint = settings.SENTRY_ENDPOINT
290284
if not endpoint:
291-
endpoint = options.get("system.url-prefix")
285+
if SiloMode.get_current_mode() == SiloMode.REGION:
286+
endpoint = generate_region_url()
287+
else:
288+
endpoint = options.get("system.url-prefix")
289+
assert endpoint is not None
292290

293-
has_org_subdomain = False
294291
try:
295292
has_org_subdomain = features.has(
296293
"organizations:org-ingest-subdomains", self.project.organization
297294
)
298295
except ProgrammingError:
299296
# This happens during migration generation for the organization model.
300-
pass
297+
has_org_subdomain = False
301298

302299
if has_org_subdomain:
303300
urlparts = urlparse(endpoint)

Diff for: src/sentry/models/team.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_for_user(
5252

5353
base_team_qs = self.filter(organization=organization, status=TeamStatus.ACTIVE)
5454

55-
if env.request and is_active_superuser(env.request) or settings.SENTRY_PUBLIC:
55+
if env.request and is_active_superuser(env.request):
5656
team_list = list(base_team_qs)
5757
else:
5858
try:

Diff for: src/sentry/organizations/services/organization/impl.py

-8
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,6 @@ def set_user_for_organization_member(
318318
def _query_organizations(
319319
self, user_id: int, scope: str | None, only_visible: bool
320320
) -> list[Organization]:
321-
from django.conf import settings
322-
323-
if settings.SENTRY_PUBLIC and scope is None:
324-
if only_visible:
325-
return list(Organization.objects.filter(status=OrganizationStatus.ACTIVE))
326-
else:
327-
return list(Organization.objects.filter())
328-
329321
qs = OrganizationMember.objects.filter(user_id=user_id)
330322

331323
qs = qs.select_related("organization")

Diff for: src/sentry/testutils/pytest/sentry.py

-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ def pytest_configure(config: pytest.Config) -> None:
145145
# override a few things with our test specifics
146146
install_plugin_apps("sentry.apps", settings)
147147
settings.INSTALLED_APPS = tuple(settings.INSTALLED_APPS) + ("fixtures",)
148-
# Need a predictable key for tests that involve checking signatures
149-
settings.SENTRY_PUBLIC = False
150148

151149
if not settings.SENTRY_CACHE:
152150
settings.SENTRY_CACHE = "sentry.cache.django.DjangoCache"

Diff for: tests/sentry/models/test_projectkey.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def test_get_dsn_with_port(self):
4343

4444
def test_get_dsn_with_public_endpoint_setting(self):
4545
key = ProjectKey(project_id=self.project.id, public_key="public", secret_key="secret")
46-
with self.settings(SENTRY_PUBLIC_ENDPOINT="http://public_endpoint.com"):
46+
with self.settings(SENTRY_ENDPOINT="http://endpoint.com"):
4747
self.assertEqual(
48-
key.get_dsn(public=True), f"http://public@public_endpoint.com/{self.project.id}"
48+
key.get_dsn(public=True), f"http://public@endpoint.com/{self.project.id}"
4949
)
5050

5151
def test_get_dsn_with_endpoint_setting(self):

0 commit comments

Comments
 (0)