Refactor test runtime ownership
This commit is contained in:
@@ -5,19 +5,6 @@ defmodule Parrhesia.Application do
|
||||
|
||||
@impl true
|
||||
def start(_type, _args) do
|
||||
children = [
|
||||
Parrhesia.Telemetry,
|
||||
Parrhesia.Config,
|
||||
Parrhesia.Storage.Supervisor,
|
||||
Parrhesia.Subscriptions.Supervisor,
|
||||
Parrhesia.Auth.Supervisor,
|
||||
Parrhesia.Sync.Supervisor,
|
||||
Parrhesia.Policy.Supervisor,
|
||||
Parrhesia.Web.Endpoint,
|
||||
Parrhesia.Tasks.Supervisor
|
||||
]
|
||||
|
||||
opts = [strategy: :one_for_one, name: Parrhesia.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
Parrhesia.Runtime.start_link(name: Parrhesia.Supervisor)
|
||||
end
|
||||
end
|
||||
|
||||
29
lib/parrhesia/runtime.ex
Normal file
29
lib/parrhesia/runtime.ex
Normal file
@@ -0,0 +1,29 @@
|
||||
defmodule Parrhesia.Runtime do
|
||||
@moduledoc false
|
||||
|
||||
use Supervisor
|
||||
|
||||
def start_link(opts \\ []) do
|
||||
name = Keyword.get(opts, :name, Parrhesia.Supervisor)
|
||||
Supervisor.start_link(__MODULE__, opts, name: name)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(_opts) do
|
||||
Supervisor.init(children(), strategy: :one_for_one)
|
||||
end
|
||||
|
||||
def children do
|
||||
[
|
||||
Parrhesia.Telemetry,
|
||||
Parrhesia.Config,
|
||||
Parrhesia.Storage.Supervisor,
|
||||
Parrhesia.Subscriptions.Supervisor,
|
||||
Parrhesia.Auth.Supervisor,
|
||||
Parrhesia.Sync.Supervisor,
|
||||
Parrhesia.Policy.Supervisor,
|
||||
Parrhesia.Web.Endpoint,
|
||||
Parrhesia.Tasks.Supervisor
|
||||
]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user