Refactor and other improvements
This commit is contained in:
parent
04a78e7bfe
commit
6c90cf3c0f
47 changed files with 2705 additions and 1568 deletions
|
|
@ -3,7 +3,7 @@ import { ScreenshotCache } from './cache.js';
|
|||
import { takeScreenshot, checkWebGL, closeBrowser } from './screenshot.js';
|
||||
|
||||
const PORT = parseInt(process.env.PORT || '8002', 10);
|
||||
const NARROWIT_URL = process.env.NARROWIT_URL || 'http://localhost:8001';
|
||||
const APP_URL = process.env.APP_URL || 'http://localhost:8001';
|
||||
const CACHE_DIR = process.env.CACHE_DIR || '/cache';
|
||||
|
||||
const cache = new ScreenshotCache(CACHE_DIR);
|
||||
|
|
@ -47,7 +47,7 @@ app.get('/screenshot', async (req, res) => {
|
|||
// Build the URL for the frontend in screenshot mode
|
||||
const qs = new URLSearchParams(params);
|
||||
qs.set('screenshot', '1');
|
||||
const url = `${NARROWIT_URL}/?${qs}`;
|
||||
const url = `${APP_URL}/?${qs}`;
|
||||
|
||||
console.log(`Taking screenshot: ${url}`);
|
||||
const png = await takeScreenshot(url);
|
||||
|
|
@ -67,7 +67,7 @@ app.get('/screenshot', async (req, res) => {
|
|||
|
||||
const server = app.listen(PORT, () => {
|
||||
console.log(`Screenshot service listening on port ${PORT}`);
|
||||
console.log(` NARROWIT_URL: ${NARROWIT_URL}`);
|
||||
console.log(` APP_URL: ${APP_URL}`);
|
||||
console.log(` CACHE_DIR: ${CACHE_DIR}`);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue