mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-16 17:05:17 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -128,37 +128,37 @@ const createCertificateFiles = async (certificate: Certificate) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const updateCertificate = async (
|
export const updateCertificate = async (
|
||||||
certificateId: string,
|
certificateId: string,
|
||||||
updates: {
|
updates: {
|
||||||
name?: string;
|
name?: string;
|
||||||
certificateData?: string;
|
certificateData?: string;
|
||||||
privateKey?: string;
|
privateKey?: string;
|
||||||
autoRenew?: boolean;
|
autoRenew?: boolean;
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const existing = await findCertificateById(certificateId);
|
const existing = await findCertificateById(certificateId);
|
||||||
|
|
||||||
const updated = await db
|
const updated = await db
|
||||||
.update(certificates)
|
.update(certificates)
|
||||||
.set({
|
.set({
|
||||||
...updates,
|
...updates,
|
||||||
})
|
})
|
||||||
.where(eq(certificates.certificateId, certificateId))
|
.where(eq(certificates.certificateId, certificateId))
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
if (!updated || updated[0] === undefined) {
|
if (!updated || updated[0] === undefined) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "Failed to update the certificate",
|
message: "Failed to update the certificate",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const cert = updated[0];
|
const cert = updated[0];
|
||||||
|
|
||||||
// If cert data or private key changed, rewrite files
|
// If cert data or private key changed, rewrite files
|
||||||
if (updates.certificateData || updates.privateKey) {
|
if (updates.certificateData || updates.privateKey) {
|
||||||
await createCertificateFiles(cert);
|
await createCertificateFiles(cert);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cert;
|
return cert;
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user