From e4245cd286bb3cb386de827d80a5ce89afa22deb Mon Sep 17 00:00:00 2001 From: ivinokur Date: Wed, 30 Oct 2024 12:55:02 +0200 Subject: [PATCH] Set SAAS Gitlab url if endpint is not defined --- .../factory/server/gitlab/GitlabUserDataFetcher.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUserDataFetcher.java b/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUserDataFetcher.java index 028a46228c..b10cfd6a6b 100644 --- a/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUserDataFetcher.java +++ b/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUserDataFetcher.java @@ -11,6 +11,8 @@ */ package org.eclipse.che.api.factory.server.gitlab; +import static com.google.common.base.Strings.isNullOrEmpty; + import javax.inject.Inject; import javax.inject.Named; import org.eclipse.che.api.factory.server.scm.*; @@ -22,11 +24,17 @@ public class GitlabUserDataFetcher extends AbstractGitlabUserDataFetcher { /** Name of this OAuth provider as found in OAuthAPI. */ private static final String OAUTH_PROVIDER_NAME = "gitlab"; + private static final String GITLAB_SAAS_ENDPOINT = "https://gitlab.com"; + @Inject public GitlabUserDataFetcher( @Nullable @Named("che.integration.gitlab.oauth_endpoint") String serverUrl, @Named("che.api") String apiEndpoint, PersonalAccessTokenManager personalAccessTokenManager) { - super(serverUrl, apiEndpoint, personalAccessTokenManager, OAUTH_PROVIDER_NAME); + super( + isNullOrEmpty(serverUrl) ? GITLAB_SAAS_ENDPOINT : serverUrl, + apiEndpoint, + personalAccessTokenManager, + OAUTH_PROVIDER_NAME); } }