Skip to content

Commit

Permalink
Set SAAS Gitlab url if endpint is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig committed Oct 30, 2024
1 parent 14f7556 commit 9dcacbb
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
package org.eclipse.che.api.factory.server.gitlab;

import static com.google.common.base.Strings.isNullOrEmpty;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
Expand All @@ -19,6 +21,7 @@
import org.eclipse.che.api.factory.server.scm.exception.ScmCommunicationException;
import org.eclipse.che.api.factory.server.scm.exception.ScmItemNotFoundException;
import org.eclipse.che.api.factory.server.scm.exception.ScmUnauthorizedException;
import org.eclipse.che.commons.annotation.Nullable;

/** Gitlab OAuth token retriever. */
public class AbstractGitlabUserDataFetcher extends AbstractGitUserDataFetcher {
Expand All @@ -29,14 +32,15 @@ public class AbstractGitlabUserDataFetcher extends AbstractGitUserDataFetcher {

public static final Set<String> DEFAULT_TOKEN_SCOPES =
ImmutableSet.of("api", "write_repository", "openid");
private static final String GITLAB_SAAS_ENDPOINT = "https://gitlab.com";

public AbstractGitlabUserDataFetcher(
String serverUrl,
@Nullable String serverUrl,
String apiEndpoint,
PersonalAccessTokenManager personalAccessTokenManager,
String providerName) {
super(providerName, serverUrl, personalAccessTokenManager);
this.serverUrl = serverUrl;
this.serverUrl = isNullOrEmpty(serverUrl) ? GITLAB_SAAS_ENDPOINT : serverUrl;
this.apiEndpoint = apiEndpoint;
this.providerName = providerName;
}
Expand Down

0 comments on commit 9dcacbb

Please sign in to comment.