Update deployment request config value if not env variables are set

This commit is contained in:
IshaVenikar 2025-02-03 16:40:03 +05:30
parent 22bb409617
commit ced815802e
2 changed files with 11 additions and 10 deletions

View File

@ -265,12 +265,15 @@ export class Registry {
throw new Error(`No record found for ${lrn}`);
}
const hash = await this.generateConfigHash(
let hash;
if (Object.keys(data.environmentVariables).length !== 0) {
hash = await this.generateConfigHash(
data.environmentVariables,
data.requesterAddress,
data.publicKey,
data.apiUrl,
);
}
// Create record of type ApplicationDeploymentRequest and publish
const applicationDeploymentRequest = {
@ -281,9 +284,7 @@ export class Registry {
dns: data.dns,
// https://git.vdb.to/cerc-io/laconic-registry-cli/commit/129019105dfb93bebcea02fde0ed64d0f8e5983b
config: JSON.stringify({
ref: hash,
}),
config: JSON.stringify(hash ? { ref: hash } : {}),
meta: JSON.stringify({
note: `Added by Snowball @ ${DateTime.utc().toFormat(
"EEE LLL dd HH:mm:ss 'UTC' yyyy"

View File

@ -243,7 +243,7 @@ export class Service {
if (oldDNSDeployment) {
// Send removal request for the previous DNS deployment and delete DB entry
if (oldDNSDeployment.url === deployment.url) {
if (oldDNSDeployment.url !== deployment.url) {
await this.laconicRegistry.createApplicationDeploymentRemovalRequest({
deploymentId: oldDNSDeployment.applicationDeploymentRecordId!,
deployerLrn: oldDNSDeployment.deployer.deployerLrn,