From be1857cf7485250cf71a29c72d5798a715e1a273 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Tue, 4 Feb 2025 12:12:45 +0530 Subject: [PATCH] Update deployment request for multiple deployers --- packages/backend/src/service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 90fae68b..402e7c75 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -688,7 +688,6 @@ export class Service { const { repo, repoUrl } = await getRepoDetails(octokit, data.project.repository, data.commitHash); const environmentVariablesObj = await this.getEnvVariables(data.project!.id!); - // To set project DNS if (data.environment === Environment.Production) { const dnsDeployment = await this.createDeploymentFromData(userId, data, deployer!.deployerLrn!, applicationRecordId, applicationRecordData, true); @@ -782,12 +781,15 @@ export class Service { }; const deployment = await this.createDeploymentFromData(project.ownerId!, deploymentData, deployerLrn, applicationRecordId, applicationRecordData, false); - const dnsDeployment = await this.createDeploymentFromData(project.ownerId!, deploymentData, deployerLrn, applicationRecordId, applicationRecordData, true); const address = await this.getAddress(); const environmentVariablesObj = await this.getEnvVariables(project!.id!); // To set project DNS if (deploymentData.environment === Environment.Production) { + const dnsDeployment = await this.createDeploymentFromData(project.ownerId!, deploymentData, deployerLrn, applicationRecordId, applicationRecordData, true); + // If a custom domain is present then use that as the DNS in the deployment request + const customDomain = await this.db.getOldestDomainByProjectId(project!.id!); + // On deleting deployment later, project DNS deployment is also deleted // So publish project DNS deployment first so that ApplicationDeploymentRecord for the same is available when deleting deployment later const { applicationDeploymentRequestId, applicationDeploymentRequestData } = @@ -796,7 +798,7 @@ export class Service { appName: repo, repository: repoUrl, environmentVariables: environmentVariablesObj, - dns: `${dnsDeployment.project.name}`, + dns: customDomain?.name ?? `${dnsDeployment.project.name}`, auctionId: project.auctionId!, lrn: deployerLrn, apiUrl: deployer!.deployerApiUrl!,