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

Commit 5ce201f

Browse files
dashtanguiTeodor Yanev
andauthored
dev-env (#1330)
* dev-env * formatting * black formatting * read the development environment flag once at module level * lint with black --------- Co-authored-by: Teodor Yanev <teodor@stacklok.com>
1 parent 3f26d50 commit 5ce201f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/codegate/updates/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
import requests
44
import structlog
5+
import os
56

67
logger = structlog.get_logger("codegate")
78

89

910
__update_client_singleton = None
1011

12+
is_dev_env = bool(os.environ.get("CODEGATE_DEV_ENV"))
13+
1114

1215
# Enum representing whether the request is coming from the front-end or the back-end.
1316
class Origin(Enum):
@@ -25,9 +28,13 @@ def get_latest_version(self, origin: Origin) -> str:
2528
"""
2629
Retrieves the latest version of CodeGate from updates.codegate.ai
2730
"""
31+
32+
user_agent = f"codegate/{self.__current_version} {origin.value}"
33+
if is_dev_env:
34+
user_agent += "-dev"
2835
headers = {
2936
"X-Instance-ID": self.__instance_id,
30-
"User-Agent": f"codegate/{self.__current_version} {origin.value}",
37+
"User-Agent": user_agent,
3138
}
3239

3340
try:

0 commit comments

Comments
 (0)