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
7 changes: 5 additions & 2 deletions lib/mix/tasks/phx.server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 10 additions & 3 deletions lib/phoenix/endpoint/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down