Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ The following environment variables can be set to change some Panthère behavior
* `PANTHERE_NO_HEADLESS`: to disable browsers's headless mode (will display the testing window, useful to debug)
* `PANTHERE_NO_SANDBOX`: to disable [Chrome's sandboxing](https://chromium.googlesource.com/chromium/src/+/b4730a0c2773d8f6728946013eb812c6d3975bec/docs/design/sandbox.md) (unsafe, but allows to use Panthère in containers)
* `PANTHERE_WEB_SERVER_DIR`: to change the project's document root (default to `public/`)
* `PANTHERE_CHROME_DRIVER_BINARY`: to use another `chromedriver` binary, instead of relying on the ones already provided by Panthère

## Docker Integration

Expand Down
6 changes: 5 additions & 1 deletion src/ProcessManager/ChromeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class ChromeManager implements BrowserManagerInterface

public function __construct(?string $chromeDriverBinary = null, ?array $arguments = null, array $options = [])
{
$this->process = new Process([$chromeDriverBinary ?? $this->findChromeDriverBinary()], null, null, null, null);
$this->process = new Process([$chromeDriverBinary ?: $this->findChromeDriverBinary()], null, null, null, null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid $chromeDriverBinary be an empty string 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can it be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a simple developer mistake, I know I might be paranoid, but if you think I should revert this, feel free to ask, and I will

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's ok! Can you just document this new env var in the README file please?

$this->arguments = $arguments ?? $this->getDefaultArguments();
$this->options = \array_merge($this->getDefaultOptions(), $options);
}
Expand Down Expand Up @@ -66,6 +66,10 @@ public function quit(): void

private function findChromeDriverBinary(): string
{
if ($binary = $_SERVER['PANTHERE_CHROME_DRIVER_BINARY'] ?? null) {
return $binary;
}

switch (PHP_OS_FAMILY) {
case 'Windows':
return __DIR__.'/../../chromedriver-bin/chromedriver.exe';
Expand Down