Skip to content

Commit

Permalink
feat(index): respect executable path for pptr
Browse files Browse the repository at this point in the history
Respects the "executable path" for puppeteer.
  • Loading branch information
jniles committed Jun 22, 2022
1 parent 5567dba commit a006e10
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,29 @@ const launch = async () => {
maxConcurrency : 2,
};

const puppeteerOptions = {};

if (process.env.CHROME_OPTIONS) {
options.puppeteerOptions = {
Object.assign(puppeteerOptions, {
args : process.env.CHROME_OPTIONS.split(' '),
};

});

debug('#launch() using extra launch arguments:', process.env.CHROME_OPTIONS);
}

if (process.env.PUPPETEER_EXECUTABLE_PATH) {
Object.assign(puppeteerOptions, {
executablePath : process.env.PUPPETEER_EXECUTABLE_PATH,
});

debug('#launch() using exeuctable path:', process.env.PUPPETEER_EXECUTABLE_PATH);
}

// merge in options if they were triggered
if (Object.entries(puppeteerOptions).length > 0) {
options.puppeteerOptions = puppeteerOptions;
}

cluster = await Cluster.launch(options);

debug('#launch(): configuring PDF rendering task');
Expand Down

0 comments on commit a006e10

Please sign in to comment.