diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index 7c6ce31a727a..cf9c3a5a68a8 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -149,6 +149,8 @@ CONFLUENCE_CONNECTOR_LABELS_TO_SKIP = [ GONG_CONNECTOR_START_TIME = os.environ.get("GONG_CONNECTOR_START_TIME") +GITHUB_CONNECTOR_BASE_URL = os.environ.get("GITHUB_CONNECTOR_BASE_URL") or None + DASK_JOB_CLIENT_ENABLED = ( os.environ.get("DASK_JOB_CLIENT_ENABLED", "").lower() == "true" ) diff --git a/backend/danswer/connectors/github/connector.py b/backend/danswer/connectors/github/connector.py index a57bca1bbb75..a2a583f98163 100644 --- a/backend/danswer/connectors/github/connector.py +++ b/backend/danswer/connectors/github/connector.py @@ -10,6 +10,7 @@ from github.Issue import Issue from github.PaginatedList import PaginatedList from github.PullRequest import PullRequest +from danswer.configs.app_configs import GITHUB_CONNECTOR_BASE_URL from danswer.configs.app_configs import INDEX_BATCH_SIZE from danswer.configs.constants import DocumentSource from danswer.connectors.interfaces import GenerateDocumentsOutput @@ -91,7 +92,13 @@ class GithubConnector(LoadConnector, PollConnector): self.github_client: Github | None = None def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None: - self.github_client = Github(credentials["github_access_token"]) + self.github_client = ( + Github( + credentials["github_access_token"], base_url=GITHUB_CONNECTOR_BASE_URL + ) + if GITHUB_CONNECTOR_BASE_URL + else Github(credentials["github_access_token"]) + ) return None def _fetch_from_github( diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 6cef38ae9906..9fe9262c342b 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -125,6 +125,7 @@ services: - CONFLUENCE_CONNECTOR_LABELS_TO_SKIP=${CONFLUENCE_CONNECTOR_LABELS_TO_SKIP:-} - GONG_CONNECTOR_START_TIME=${GONG_CONNECTOR_START_TIME:-} - NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP=${NOTION_CONNECTOR_ENABLE_RECURSIVE_PAGE_LOOKUP:-} + - GITHUB_CONNECTOR_BASE_URL=${GITHUB_CONNECTOR_BASE_URL:-} # Danswer SlackBot Configs - DANSWER_BOT_SLACK_APP_TOKEN=${DANSWER_BOT_SLACK_APP_TOKEN:-} - DANSWER_BOT_SLACK_BOT_TOKEN=${DANSWER_BOT_SLACK_BOT_TOKEN:-}