From c6f74628430b24c53aaceb6d864d8768e1911690 Mon Sep 17 00:00:00 2001 From: jszuminski Date: Tue, 13 Aug 2024 11:56:12 +0200 Subject: [PATCH] Added #567, PUPPETEER_DIR made configurable. --- lib/browser.js | 4 ++-- lib/envs.js | 3 +++ lib/schemas/config.js | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/browser.js b/lib/browser.js index bd42990d..a5d12ddf 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -59,14 +59,14 @@ export function get() { */ export async function create(puppeteerArgs) { // Get debug and other options - const { debug, other } = getOptions(); + const { puppeteer, debug, other } = getOptions(); // Get the debug options const { enable: enabledDebug, ...debugOptions } = debug; const launchOptions = { headless: other.browserShellMode ? 'shell' : true, - userDataDir: './tmp/', + userDataDir: puppeteer.dir, args: puppeteerArgs, handleSIGINT: false, handleSIGTERM: false, diff --git a/lib/envs.js b/lib/envs.js index 885d7f07..d36438d1 100644 --- a/lib/envs.js +++ b/lib/envs.js @@ -127,6 +127,9 @@ export const Config = z.object({ HIGHCHARTS_CACHE_PATH: v.string(), HIGHCHARTS_ADMIN_TOKEN: v.string(), + // puppeteer + PUPPETEER_DIR: v.string(), + // export EXPORT_TYPE: v.enum(['jpeg', 'png', 'pdf', 'svg']), EXPORT_CONSTR: v.enum(['chart', 'stockChart', 'mapChart', 'ganttChart']), diff --git a/lib/schemas/config.js b/lib/schemas/config.js index 50600dfd..b8add892 100644 --- a/lib/schemas/config.js +++ b/lib/schemas/config.js @@ -146,6 +146,12 @@ export const defaultConfig = { ], type: 'string[]', description: 'Arguments array to send to Puppeteer.' + }, + dir: { + value: './tmp/', + type: 'string', + envLink: 'PUPPETEER_DIR', + description: 'The directory for Puppeteer to store temporary files.' } }, highcharts: {