Make test URL configurable with TEST_URL env var. resolves #240

This commit is contained in:
ngosang 2021-12-11 18:35:37 +01:00
parent a24b665bd1
commit c4ef6a472e
2 changed files with 4 additions and 1 deletions

View File

@ -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`. 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. 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. 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. 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. HOST | 0.0.0.0 | Listening interface. You don't need to change this if you are running on Docker.

View File

@ -94,11 +94,13 @@ export async function testWebBrowserInstallation(): Promise<void> {
log.debug("FlareSolverr user home directory is OK: " + homeDir) log.debug("FlareSolverr user home directory is OK: " + homeDir)
// test web browser // test web browser
const testUrl = process.env.TEST_URL || "https://www.google.com";
log.debug("Test URL: " + testUrl)
const session = await create(null, { const session = await create(null, {
oneTimeSession: true oneTimeSession: true
}) })
const page = await session.browser.newPage() const page = await session.browser.newPage()
await page.goto("https://www.google.com") await page.goto(testUrl)
webBrowserUserAgent = await page.evaluate(() => navigator.userAgent) webBrowserUserAgent = await page.evaluate(() => navigator.userAgent)
// replace Linux ARM user-agent because it's detected // replace Linux ARM user-agent because it's detected