Use Bandit child spec directly
This commit is contained in:
1
AUDIT.md
1
AUDIT.md
@@ -41,6 +41,7 @@ after each item.
|
|||||||
- [x] `ui/registry.ex` O(1) lookups (verified keep: compile-time caching would freeze localized labels)
|
- [x] `ui/registry.ex` O(1) lookups (verified keep: compile-time caching would freeze localized labels)
|
||||||
- [x] `bounded_atoms.ex` O(1) allow-lists
|
- [x] `bounded_atoms.ex` O(1) allow-lists
|
||||||
- [x] `scripting/job_store.ex`
|
- [x] `scripting/job_store.ex`
|
||||||
|
- [x] `desktop/server.ex`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
defmodule BDS.Desktop.Server do
|
defmodule BDS.Desktop.Server do
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
|
||||||
use GenServer
|
|
||||||
|
|
||||||
def child_spec(opts) do
|
def child_spec(opts) do
|
||||||
%{
|
Supervisor.child_spec(
|
||||||
id: __MODULE__,
|
{Bandit,
|
||||||
start: {__MODULE__, :start_link, [opts]}
|
Keyword.merge(opts,
|
||||||
}
|
plug: BDS.Desktop.Endpoint,
|
||||||
end
|
scheme: :http,
|
||||||
|
ip: {127, 0, 0, 1},
|
||||||
def start_link(opts) do
|
port: port(),
|
||||||
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
|
startup_log: false
|
||||||
|
)},
|
||||||
|
id: __MODULE__
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def url do
|
def url do
|
||||||
@@ -24,18 +25,4 @@ defmodule BDS.Desktop.Server do
|
|||||||
_other -> Application.get_env(:bds, :desktop)[:port] || 4010
|
_other -> Application.get_env(:bds, :desktop)[:port] || 4010
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
|
||||||
def init(_opts) do
|
|
||||||
{:ok, bandit_pid} =
|
|
||||||
Bandit.start_link(
|
|
||||||
plug: BDS.Desktop.Endpoint,
|
|
||||||
scheme: :http,
|
|
||||||
ip: {127, 0, 0, 1},
|
|
||||||
port: port(),
|
|
||||||
startup_log: false
|
|
||||||
)
|
|
||||||
|
|
||||||
{:ok, %{bandit_pid: bandit_pid}}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user