diff --git a/services/certificate.service.js b/services/certificate.service.js index 1225ed8..3a957cc 100644 --- a/services/certificate.service.js +++ b/services/certificate.service.js @@ -21,6 +21,11 @@ const execFileAsync = promisify(execFile); const TEMPLATE_PATH = path.join(__dirname, '../templates/certificate.typ'); const FONT_PATH = path.join(__dirname, '../templates/fonts/Arimo'); +// The Docker image gets `typst` on PATH via COPY --from=typst. Bare-metal +// deploys (no Docker involved) don't have that, so TYPST_BIN lets ops point +// at a manually-installed binary instead. +const TYPST_BIN = process.env.TYPST_BIN || 'typst'; + /** * @param {{ * name: string, @@ -52,7 +57,7 @@ async function generateCertificate({ name, course, date, cert_no, ref_no, instru if (length) args.push('--input', `length=${length}`); try { - await execFileAsync('typst', args); + await execFileAsync(TYPST_BIN, args); return await fs.readFile(outPath); } finally { await fs.unlink(outPath).catch(() => {});