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

dev-env #1330

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/codegate/updates/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import requests
import structlog
import os

logger = structlog.get_logger("codegate")


__update_client_singleton = None

is_dev_env = bool(os.environ.get("CODEGATE_DEV_ENV"))


# Enum representing whether the request is coming from the front-end or the back-end.
class Origin(Enum):
Expand All @@ -25,9 +28,13 @@ def get_latest_version(self, origin: Origin) -> str:
"""
Retrieves the latest version of CodeGate from updates.codegate.ai
"""

user_agent = f"codegate/{self.__current_version} {origin.value}"
if is_dev_env:
user_agent += "-dev"
headers = {
"X-Instance-ID": self.__instance_id,
"User-Agent": f"codegate/{self.__current_version} {origin.value}",
"User-Agent": user_agent,
}

try:
Expand Down
Loading