holsee / chroxy

Headless Chrome as a Service

Home Page:https://hex.pm/packages/chroxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Chromium and configurable Chrome Path

holsee opened this issue · comments

Short term goal would be to support configuration of the path (as per other configuration through environment variables).

This function would need to be modified:

defp chrome_path do
case :os.type() do
{:unix, :darwin} ->
"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
{:unix, _} ->
"/usr/bin/google-chrome"
end

From early testing, Chromium was fully compatible.

FWIW, I'm able to set a different browser path with:

config :chroxy, Chroxy.ChromeServer, chrome_path: System.get_env("CHROXY_CHROME_PATH")

in my own app's config.exs when using Chroxy as a library.

Is the implementation of this feature just adding the above line to Chroxy's config.exs?

Looks like I have implemented this and forgot:

config = Application.get_env(:chroxy, __MODULE__)
opts =
default_opts()
|> Keyword.merge(config)
|> Keyword.merge(args)

I would suggest we document this in the README or we add that ENV VAR as something baked in that will take the first precedence.

Documentation should be fine.