diff --git a/td.server/src/env/Gitlab.js b/td.server/src/env/Gitlab.js index c50a4b741..516946267 100644 --- a/td.server/src/env/Gitlab.js +++ b/td.server/src/env/Gitlab.js @@ -14,9 +14,7 @@ class GitlabEnv extends Env { { key: 'CLIENT_ID', required: false }, { key: 'CLIENT_SECRET', required: false }, { key: 'SCOPE', required: false }, - { key: 'ENTERPRISE_HOSTNAME', required: false }, - { key: 'ENTERPRISE_PROTOCOL', required: false }, - { key: 'ENTERPRISE_PORT', required: false }, + { key: 'HOST', required: false }, { key: 'USE_SEARCH', required: false }, { key: 'SEARCH_QUERY', required: false }, { key: 'REDIRECT_URI', required: false }, diff --git a/td.server/src/providers/gitlab.js b/td.server/src/providers/gitlab.js index 54adcbfb4..73a4431d3 100644 --- a/td.server/src/providers/gitlab.js +++ b/td.server/src/providers/gitlab.js @@ -20,14 +20,7 @@ const isConfigured = () => Boolean(env.get().config.GITLAB_CLIENT_ID); * @returns {String} */ const getGitlabUrl = () => { - const enterpriseHostname = env.get().config.GITLAB_ENTERPRISE_HOSTNAME; - if(enterpriseHostname) { - const port = env.get().config.GITLAB_ENTERPRISE_PORT || ''; - const protocol = env.get().config.GITLAB_ENTERPRISE_PROTOCOL || 'https'; - const enterpriseUrl = `${protocol}://${enterpriseHostname}${port ? ':' + port : ''}`; - return enterpriseUrl; - } - return 'https://gitlab.com'; + return env.get().config.GITLAB_HOST || 'https://gitlab.com'; }; /** diff --git a/td.server/src/repositories/gitlabrepo.js b/td.server/src/repositories/gitlabrepo.js index 9b0bd984f..4cd374127 100644 --- a/td.server/src/repositories/gitlabrepo.js +++ b/td.server/src/repositories/gitlabrepo.js @@ -11,17 +11,15 @@ export class GitlabClientWrapper { } export const getClient = (accessToken) => { - - - const enterpriseHostname = env.get().config.GITLAB_ENTERPRISE_HOSTNAME; - if (enterpriseHostname) { - throw new Error(`Gitlab Enterprise is not supported yet`); - } - const clientOptions = { + let clientOptions = { auth: { oauthToken: accessToken, }, }; + if (env.get().config.GITLAB_HOST) { + clientOptions.auth['host']=env.get().config.GITLAB_HOST + } + return GitlabClientWrapper.getClient(clientOptions.auth); };