This is what I am using:
{:phoenix, "~> 1.7.2"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.18.16"},
This is the source of Desktop.Endpoint
I currently have:
defmodule Desktop.Endpoint do
@doc false
defmacro __using__(opts) do
quote do
use Phoenix.Endpoint, unquote(opts)
defoverridable url: 0
def url do
url =
Phoenix.Config.cache(
__MODULE__,
:__phoenix_url__,
&Phoenix.Endpoint.Supervisor.url/1
)
endpoint = Module.safe_concat(__MODULE__, HTTP)
String.replace(url, ":0", ":#{:ranch.get_port(endpoint)}")
end
end
end
end
There is no if
statement here. Perhaps the latest version is not in hex?