fix: change hardcoded gitlab.com to gitlabUrl

This commit is contained in:
djknaeckebrot
2024-12-10 08:53:53 +01:00
parent 22e6d07f60
commit 7ced6840fa
2 changed files with 5 additions and 4 deletions

View File

@@ -78,6 +78,7 @@ export const gitlabRouter = createTRPCRouter({
.input(apiFindOneGitlab) .input(apiFindOneGitlab)
.query(async ({ input, ctx }) => { .query(async ({ input, ctx }) => {
const gitlabProvider = await findGitlabById(input.gitlabId); const gitlabProvider = await findGitlabById(input.gitlabId);
console.log("DEBUG: gitlabProvider: ", gitlabProvider);
if (IS_CLOUD && gitlabProvider.gitProvider.adminId !== ctx.user.adminId) { if (IS_CLOUD && gitlabProvider.gitProvider.adminId !== ctx.user.adminId) {
//TODO: Remove this line when the cloud version is ready //TODO: Remove this line when the cloud version is ready
throw new TRPCError({ throw new TRPCError({

View File

@@ -244,7 +244,7 @@ export const getGitlabRepositories = async (gitlabId?: string) => {
const gitlabProvider = await findGitlabById(gitlabId); const gitlabProvider = await findGitlabById(gitlabId);
const response = await fetch( const response = await fetch(
`https://gitlab.com/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`, `${gitlabProvider.gitlabUrl}/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`,
{ {
headers: { headers: {
Authorization: `Bearer ${gitlabProvider.accessToken}`, Authorization: `Bearer ${gitlabProvider.accessToken}`,
@@ -304,7 +304,7 @@ export const getGitlabBranches = async (input: {
const gitlabProvider = await findGitlabById(input.gitlabId); const gitlabProvider = await findGitlabById(input.gitlabId);
const branchesResponse = await fetch( const branchesResponse = await fetch(
`https://gitlab.com/api/v4/projects/${input.id}/repository/branches`, `${gitlabProvider.gitlabUrl}/api/v4/projects/${input.id}/repository/branches`,
{ {
headers: { headers: {
Authorization: `Bearer ${gitlabProvider.accessToken}`, Authorization: `Bearer ${gitlabProvider.accessToken}`,
@@ -352,7 +352,7 @@ export const cloneRawGitlabRepository = async (entity: Compose) => {
await recreateDirectory(outputPath); await recreateDirectory(outputPath);
const gitlabUrl = gitlabProvider.gitlabUrl; const gitlabUrl = gitlabProvider.gitlabUrl;
// What happen with oauth in self hosted instances? // What happen with oauth in self hosted instances?
const repoclone = `gitlab.com/${gitlabPathNamespace}.git`; const repoclone = `${gitlabProvider.gitlabUrl}/${gitlabPathNamespace}.git`;
const cloneUrl = `https://oauth2:${gitlabProvider?.accessToken}@${repoclone}`; const cloneUrl = `https://oauth2:${gitlabProvider?.accessToken}@${repoclone}`;
try { try {
@@ -392,7 +392,7 @@ export const cloneRawGitlabRepositoryRemote = async (compose: Compose) => {
await refreshGitlabToken(gitlabId); await refreshGitlabToken(gitlabId);
const basePath = COMPOSE_PATH; const basePath = COMPOSE_PATH;
const outputPath = join(basePath, appName, "code"); const outputPath = join(basePath, appName, "code");
const repoclone = `gitlab.com/${gitlabPathNamespace}.git`; const repoclone = `${gitlabProvider.gitlabUrl}/${gitlabPathNamespace}.git`;
const cloneUrl = `https://oauth2:${gitlabProvider?.accessToken}@${repoclone}`; const cloneUrl = `https://oauth2:${gitlabProvider?.accessToken}@${repoclone}`;
try { try {
const command = ` const command = `