From c4ef6a472e9ba6abe190fd73022bbff5c0707861 Mon Sep 17 00:00:00 2001 From: ngosang Date: Sat, 11 Dec 2021 18:35:37 +0100 Subject: [PATCH] Make test URL configurable with TEST_URL env var. resolves #240 --- README.md | 1 + src/services/sessions.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ecf9e4..c7a1a41 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ CAPTCHA_SOLVER | none | Captcha solving method. It is used when a captcha is enc TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. HEADLESS | true | Only for debugging. To run the web browser in headless mode or visible. BROWSER_TIMEOUT | 30000 | If you are experiencing errors/timeouts because your system is slow, you can try to increase this value. Remember to increase the `maxTimeout` parameter too. +TEST_URL | https://www.google.com | FlareSolverr makes a request on start to make sure the web browser is working. You can change that URL if it is blocked in your country. PORT | 8191 | Listening port. You don't need to change this if you are running on Docker. HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker. diff --git a/src/services/sessions.ts b/src/services/sessions.ts index cabc0bf..de8a8d1 100644 --- a/src/services/sessions.ts +++ b/src/services/sessions.ts @@ -94,11 +94,13 @@ export async function testWebBrowserInstallation(): Promise { log.debug("FlareSolverr user home directory is OK: " + homeDir) // test web browser + const testUrl = process.env.TEST_URL || "https://www.google.com"; + log.debug("Test URL: " + testUrl) const session = await create(null, { oneTimeSession: true }) const page = await session.browser.newPage() - await page.goto("https://www.google.com") + await page.goto(testUrl) webBrowserUserAgent = await page.evaluate(() => navigator.userAgent) // replace Linux ARM user-agent because it's detected