-
-
Notifications
You must be signed in to change notification settings - Fork 235
Allow using an env var to determine chrome driver binary #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dunglas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also document this environment variable in the README please?
| 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
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 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can it be?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
src/ProcessManager/ChromeManager.php
Outdated
|
|
||
| private function findChromeDriverBinary(): string | ||
| { | ||
| if (false !== $binary = \getenv('PANTHERE_CHROME_DRIVER_BINARY')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use $_ENV in other places (getenv isn't thread safe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
Thanks @Pierstoval |
* Allow using an env var to determine chrome driver binary * Added small documentation to use the PANTHERE_CHROME_DRIVER_BINARY env var
* Allow using an env var to determine chrome driver binary * Added small documentation to use the PANTHERE_CHROME_DRIVER_BINARY env var
My problem is that Panthère doesn't work on Alpine (because on Alpine we should either use the driver coming from the repository, or recompile it manually).
For this, it could be nice to tell Alpine users to use either the package or to recompile it instead of using Panthère's provided binary. And in general, to get the latest version, it's better to propose them to download the package in another way, for them to be sure 😅.
For now, an env var is the best solution to use another binary, to me.
WDYT?