Skip to content

Commit

Permalink
Fix docs when generating with --adapter=cowboy (#5716)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoefmoraes committed Feb 23, 2024
1 parent f9fc22b commit 05af7d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions installer/lib/phx_new/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ defmodule Phx.New.Generator do
{adapter_app, adapter_module, adapter_config} =
get_ecto_adapter(db, String.downcase(project.app), project.app_mod)

{web_adapter_app, web_adapter_vsn, web_adapter_module} = get_web_adapter(web_adapter)
{web_adapter_app, web_adapter_vsn, web_adapter_module, web_adapter_docs} = get_web_adapter(web_adapter)

pubsub_server = get_pubsub_server(project.app_mod)

Expand Down Expand Up @@ -235,6 +235,7 @@ defmodule Phx.New.Generator do
web_adapter_app: web_adapter_app,
web_adapter_module: web_adapter_module,
web_adapter_vsn: web_adapter_vsn,
web_adapter_docs: web_adapter_docs,
generators: nil_if_empty(project.generators ++ adapter_generators(adapter_config)),
namespaced?: namespaced?(project),
dev: dev
Expand Down Expand Up @@ -303,8 +304,8 @@ defmodule Phx.New.Generator do
Mix.raise("Unknown database #{inspect(db)}")
end

defp get_web_adapter("cowboy"), do: {:plug_cowboy, "~> 2.7", Phoenix.Endpoint.Cowboy2Adapter}
defp get_web_adapter("bandit"), do: {:bandit, "~> 1.2", Bandit.PhoenixAdapter}
defp get_web_adapter("cowboy"), do: {:plug_cowboy, "~> 2.7", Phoenix.Endpoint.Cowboy2Adapter, "https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html"}
defp get_web_adapter("bandit"), do: {:bandit, "~> 1.2", Bandit.PhoenixAdapter, "https://hexdocs.pm/bandit/Bandit.html#t:options/0"}
defp get_web_adapter(other), do: Mix.raise("Unknown web adapter #{inspect(other)}")

defp fs_db_config(app, module) do
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_single/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if config_env() == :prod do
http: [
# Enable IPv6 and bind on all interfaces.
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
# See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0
# See the documentation on <%= @web_adapter_docs %>
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: port
Expand Down

0 comments on commit 05af7d9

Please sign in to comment.