Skip to content

Commit

Permalink
Add support for Bandit.PhoenixAdapter.server_info/1
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrudel committed Nov 2, 2023
1 parent 99fba3f commit 875557a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/bandit/phoenix_adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ defmodule Bandit.PhoenixAdapter do
end
end

@doc """
Returns the bound address and port of the Bandit server process for the provided
scheme within the given Phoenix Endpoint
"""
def server_info(endpoint, scheme) do
case bandit_pid(endpoint, scheme) do
{:ok, pid} -> ThousandIsland.listener_info(pid)
{:error, reason} -> {:error, reason}
end
end

@doc false
def child_specs(endpoint, config) do
plug = resolve_plug(config[:code_reloader], endpoint)
Expand Down

0 comments on commit 875557a

Please sign in to comment.