install missing libraries and font
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -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(() => {});
|
||||
|
||||
Reference in New Issue
Block a user