Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions installer/templates/phx_single/config/dev.exs.eex
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,7 @@ config :<%= @app_name %>, <%= @endpoint_module %>,<%= if @inside_docker_env? do
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.<%= if @html do %>

# Reload browser tabs when matching files change.
config :<%= @app_name %>, <%= @endpoint_module %>,
live_reload: [
web_console_logger: true,
patterns: [
# Static assets, except user uploads
~r"priv/static/(?!uploads/).*\.(js|css|png|jpeg|jpg|gif|svg)$"<%= @config_regex_E %>,<%= if @gettext do %>
# Gettext translations
~r"priv/gettext/.*\.po$"<%= @config_regex_E %>,<% end %>
# Router, Controllers, LiveViews and LiveComponents
~r"lib/<%= @lib_web_name %>/router\.ex$"<%= @config_regex_E %>,
~r"lib/<%= @lib_web_name %>/(controllers|live|components)/.*\.(ex|heex)$"<%= @config_regex_E %>
]
]<% end %>
# different ports.

# Enable dev routes for dashboard and mailbox
config :<%= @app_name %>, dev_routes: true
Expand Down
19 changes: 18 additions & 1 deletion installer/templates/phx_single/config/runtime.exs.eex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,24 @@ end

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

<%= if @html do %>
if config_env() == :dev do
# Reload browser tabs when matching files change.
config :<%= @app_name %>, <%= @endpoint_module %>,
live_reload: [
web_console_logger: true,
patterns: [
# Static assets, except user uploads
~r"priv/static/(?!uploads/).*\.(js|css|png|jpeg|jpg|gif|svg)$"<%= @config_regex_E %>,<%= if @gettext do %>
# Gettext translations
~r"priv/gettext/.*\.po$"<%= @config_regex_E %>,<% end %>
# Router, Controllers, LiveViews and LiveComponents
~r"lib/<%= @lib_web_name %>/router\.ex$"<%= @config_regex_E %>,
~r"lib/<%= @lib_web_name %>/(controllers|live|components)/.*\.(ex|heex)$"<%= @config_regex_E %>
]
]
end
<% end %>
if config_env() == :prod do
# The secret key base is used to sign/encrypt cookies and other secrets.
# A default value is used in config/dev.exs and config/test.exs but you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,7 @@ config :<%= @web_app_name %>, <%= @endpoint_module %>,<%= if @inside_docker_env?
#
# If desired, both `http:` and `https:` keys can be
# configured to run both http and https servers on
# different ports.<%= if @html do %>

# Reload browser tabs when matching files change.
config :<%= @web_app_name %>, <%= @endpoint_module %>,
live_reload: [
web_console_logger: true,
patterns: [
# Static assets, except user uploads
~r"priv/static/(?!uploads/).*\.(js|css|png|jpeg|jpg|gif|svg)$"<%= @config_regex_E %>,<%= if @gettext do %>
# Gettext translations
~r"priv/gettext/.*\.po$"<%= @config_regex_E %>,<% end %>
# Router, Controllers, LiveViews and LiveComponents
~r"lib/<%= @web_app_name %>/router\.ex$"<%= @config_regex_E %>,
~r"lib/<%= @web_app_name %>/(controllers|live|components)/.*\.(ex|heex)$"<%= @config_regex_E %>
]
]<% end %>
# different ports.

# Enable dev routes for dashboard and mailbox
config :<%= @web_app_name %>, dev_routes: true
19 changes: 18 additions & 1 deletion installer/templates/phx_umbrella/config/runtime.exs.eex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ import Config

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

<%= if @html do %>
if config_env() == :dev do
# Reload browser tabs when matching files change.
config :<%= @web_app_name %>, <%= @endpoint_module %>,
live_reload: [
web_console_logger: true,
patterns: [
# Static assets, except user uploads
~r"priv/static/(?!uploads/).*\.(js|css|png|jpeg|jpg|gif|svg)$"<%= @config_regex_E %>,<%= if @gettext do %>
# Gettext translations
~r"priv/gettext/.*\.po$"<%= @config_regex_E %>,<% end %>
# Router, Controllers, LiveViews and LiveComponents
~r"lib/<%= @web_app_name %>/router\.ex$"<%= @config_regex_E %>,
~r"lib/<%= @web_app_name %>/(controllers|live|components)/.*\.(ex|heex)$"<%= @config_regex_E %>
]
]
end
<% end %>
if config_env() == :prod do
config :<%= @app_name %>, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
end
5 changes: 3 additions & 2 deletions installer/test/phx_new_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ defmodule Mix.Tasks.Phx.NewTest do
assert file =~
~r/^ http: \[port: String.to_integer\(System.get_env\("PORT", "4000"\)\)\]$/m

assert file =~ "lib/phx_blog_web/router\\.ex$"
assert file =~ "lib/phx_blog_web/(controllers|live|components)/.*\\.(ex|heex)$"
assert file =~ ~r/^\s+ip: {0, 0, 0, 0, 0, 0, 0, 0}$/m
end)

Expand Down Expand Up @@ -150,8 +152,7 @@ defmodule Mix.Tasks.Phx.NewTest do

assert_file("phx_blog/config/dev.exs", fn file ->
assert file =~ "esbuild: {Esbuild,"
assert file =~ "lib/phx_blog_web/router\\.ex$"
assert file =~ "lib/phx_blog_web/(controllers|live|components)/.*\\.(ex|heex)$"
refute file =~ "live_reload"
assert file =~ "http: [ip: {127, 0, 0, 1}]"
end)

Expand Down
5 changes: 3 additions & 2 deletions installer/test/phx_new_umbrella_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do

assert_file(root_path(@app, "config/dev.exs"), fn file ->
assert file =~ ~r[esbuild: {Esbuild]
assert file =~ "lib/#{@app}_web/router\\.ex$"
assert file =~ "lib/#{@app}_web/(controllers|live|components)/.*\\.(ex|heex)$"
refute file =~ "live_reload"
assert file =~ "config :#{@app}_web, dev_routes: true"
end)

Expand All @@ -85,6 +84,8 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
assert file =~
~r/^\s+config :phx_umb_web, PhxUmbWeb.Endpoint,\n\s+http: \[port: String\.to_integer\(System\.get_env\("PORT", "4000"\)\)\]$/m

assert file =~ "lib/#{@app}_web/router\\.ex$"
assert file =~ "lib/#{@app}_web/(controllers|live|components)/.*\\.(ex|heex)$"
assert file =~ ~r/^\s+ip: {0, 0, 0, 0, 0, 0, 0, 0}$/m
end)

Expand Down
Loading