diff --git a/lib/mix/tasks/phx.server.ex b/lib/mix/tasks/phx.server.ex index f0d85b01f5..5a0704622d 100644 --- a/lib/mix/tasks/phx.server.ex +++ b/lib/mix/tasks/phx.server.ex @@ -6,8 +6,11 @@ defmodule Mix.Tasks.Phx.Server do @moduledoc """ Starts the application by configuring all endpoints servers to run. - Note: to start the endpoint without using this mix task you must set - `server: true` in your `Phoenix.Endpoint` configuration. + Note: + - to start the endpoint without using this mix task you must set `server: + true` in your `Phoenix.Endpoint` configuration. + - if you have set `server: false` in your `Phoenix.Endpoint` configuration + this task will not override that, so the endpoint servers will not run. ## Command line options diff --git a/lib/phoenix/endpoint/supervisor.ex b/lib/phoenix/endpoint/supervisor.ex index 9c5f1909fd..75a5d0687c 100644 --- a/lib/phoenix/endpoint/supervisor.ex +++ b/lib/phoenix/endpoint/supervisor.ex @@ -217,9 +217,16 @@ defmodule Phoenix.Endpoint.Supervisor do end defp server?(conf) when is_list(conf) do - Keyword.get_lazy(conf, :server, fn -> - Application.get_env(:phoenix, :serve_endpoints, false) - end) + serve_endpoints = Application.get_env(:phoenix, :serve_endpoints, false) + server = Keyword.get(conf, :server, serve_endpoints) + + if not server and serve_endpoints, + do: + Logger.warning( + ":server is set to :false in your Phoenix.Endpoint configuration, so the server will not be started" + ) + + server end defp defaults(otp_app, module) do