Skip to content

Commit 9c3e921

Browse files
authored
Fix endpoint port config in an umbrella application. (#6549)
* Correctly configure endpoint port in an umbrella application. * Test for port config.
1 parent fe915d3 commit 9c3e921

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

installer/templates/phx_umbrella/config/runtime.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Config
77
# any compile-time configuration in here, as it won't be applied.
88
# The block below contains prod specific runtime configuration.
99

10-
config :<%= @app_name %>, <%= @endpoint_module %>,
10+
config :<%= @web_app_name %>, <%= @endpoint_module %>,
1111
http: [port: String.to_integer(System.get_env("PORT", "4000"))]
1212

1313
if config_env() == :prod do

installer/test/phx_new_umbrella_test.exs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
8181
assert file =~ "port: 80"
8282
end)
8383

84-
assert_file(root_path(@app, "config/runtime.exs"), ~r/ip: {0, 0, 0, 0, 0, 0, 0, 0}/)
84+
assert_file(root_path(@app, "config/runtime.exs"), fn file ->
85+
assert file =~
86+
~r/^\s+config :phx_umb_web, PhxUmbWeb.Endpoint,\n\s+http: \[port: String\.to_integer\(System\.get_env\("PORT", "4000"\)\)\]$/m
87+
88+
assert file =~ ~r/^\s+ip: {0, 0, 0, 0, 0, 0, 0, 0}$/m
89+
end)
8590

8691
assert_file(root_path(@app, ".formatter.exs"), fn file ->
8792
assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"

0 commit comments

Comments
 (0)