forked from cerc-io/snowballtools-base
Fix DNS records data not getting stored in the DB
This commit is contained in:
committed by
IshaVenikar
parent
624f36155a
commit
9784eb4f4a
@@ -16,7 +16,7 @@ import {
|
||||
ApplicationDeploymentRequest,
|
||||
ApplicationDeploymentRemovalRequest
|
||||
} from './entity/Deployment';
|
||||
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionParams, DeployerRecord, DNSRecordAttributes } from './types';
|
||||
import { AppDeploymentRecord, AppDeploymentRemovalRecord, AuctionParams, DeployerRecord, DNSRecord, DNSRecordAttributes } from './types';
|
||||
import { getConfig, getRepoDetails, registryTransactionWithRetry, sleep } from './utils';
|
||||
|
||||
const log = debug('snowball:registry');
|
||||
@@ -446,7 +446,7 @@ export class Registry {
|
||||
/**
|
||||
* Fetch deployment DNS Records by filter
|
||||
*/
|
||||
async getDNSRecordsByFilter(filter: { [key: string]: any }): Promise<DNSRecordAttributes[]> {
|
||||
async getDNSRecordsByFilter(filter: { [key: string]: any }): Promise<DNSRecord[]> {
|
||||
return this.registry.queryRecords(
|
||||
{
|
||||
type: DNS_RECORD_TYPE,
|
||||
|
||||
@@ -206,11 +206,11 @@ export class Service {
|
||||
})
|
||||
|
||||
const dnsRecordData: DNSRecordAttributes = {
|
||||
name: dnsRecords[0].name,
|
||||
request: dnsRecords[0].request,
|
||||
resourceType: dnsRecords[0].resourceType,
|
||||
value: dnsRecords[0].value,
|
||||
version: dnsRecords[0].version,
|
||||
name: dnsRecords[0].attributes.name,
|
||||
request: dnsRecords[0].attributes.request,
|
||||
resourceType: dnsRecords[0].attributes.resourceType,
|
||||
value: dnsRecords[0].attributes.value,
|
||||
version: dnsRecords[0].attributes.version,
|
||||
}
|
||||
|
||||
deployment.applicationDeploymentRecordId = record.id;
|
||||
@@ -665,11 +665,7 @@ export class Service {
|
||||
const environmentVariablesObj = await this.getEnvVariables(data.project!.id!);
|
||||
|
||||
// If a custom domain is present then use that as the DNS in the deployment request
|
||||
const domain = await this.db.getOldestDomainByProjectId(data.projectId!);
|
||||
let dns: string | undefined = undefined;
|
||||
if (domain) {
|
||||
dns = domain[0].name;
|
||||
}
|
||||
const domain = await this.db.getOldestDomainByProjectId(data.project!.id!);
|
||||
|
||||
// To set project DNS
|
||||
if (data.environment === Environment.Production) {
|
||||
@@ -680,7 +676,7 @@ export class Service {
|
||||
appName: repo,
|
||||
repository: repoUrl,
|
||||
environmentVariables: environmentVariablesObj,
|
||||
dns: `${newDeployment.project.name}`,
|
||||
dns: domain?.[0]?.name ?? `${newDeployment.project.name}`,
|
||||
lrn: deployer!.deployerLrn!,
|
||||
apiUrl: deployer!.deployerApiUrl!,
|
||||
payment: data.project.txHash,
|
||||
@@ -698,7 +694,7 @@ export class Service {
|
||||
lrn: deployer!.deployerLrn!,
|
||||
apiUrl: deployer!.deployerApiUrl!,
|
||||
environmentVariables: environmentVariablesObj,
|
||||
dns: dns || `${newDeployment.project.name}-${newDeployment.id}`,
|
||||
dns: `${newDeployment.project.name}-${newDeployment.id}`,
|
||||
payment: data.project.txHash,
|
||||
auctionId: data.project.auctionId,
|
||||
requesterAddress: address,
|
||||
|
||||
@@ -72,6 +72,10 @@ export interface AppDeploymentRemovalRecord extends RegistryRecord {
|
||||
attributes: AppDeploymentRemovalRecordAttributes;
|
||||
}
|
||||
|
||||
export interface DNSRecord extends RegistryRecord {
|
||||
attributes: DNSRecordAttributes
|
||||
}
|
||||
|
||||
export interface AddProjectFromTemplateInput {
|
||||
templateOwner: string;
|
||||
templateRepo: string;
|
||||
|
||||
Reference in New Issue
Block a user