2023-04-26 21:29:54 +00:00
|
|
|
defmodule Example.Application do
|
|
|
|
|
# See https://hexdocs.pm/elixir/Application.html
|
|
|
|
|
# for more information on OTP Applications
|
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
|
|
use Application
|
|
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
|
def start(_type, _args) do
|
2026-04-10 12:11:24 +00:00
|
|
|
node_js_children =
|
|
|
|
|
if Application.get_env(:live_svelte, :ssr_module, nil) == LiveSvelte.SSR.NodeJS do
|
|
|
|
|
[{NodeJS.Supervisor, [path: LiveSvelte.SSR.NodeJS.server_path(), pool_size: 4]}]
|
|
|
|
|
else
|
|
|
|
|
[]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
children = node_js_children ++ [
|
2023-04-26 21:29:54 +00:00
|
|
|
# Start the Telemetry supervisor
|
|
|
|
|
ExampleWeb.Telemetry,
|
2026-01-31 22:14:15 +00:00
|
|
|
# Start the Ecto repository
|
|
|
|
|
Example.Repo,
|
2023-04-26 21:29:54 +00:00
|
|
|
# Start the PubSub system
|
|
|
|
|
{Phoenix.PubSub, name: Example.PubSub},
|
|
|
|
|
# Start the Endpoint (http/https)
|
|
|
|
|
ExampleWeb.Endpoint
|
|
|
|
|
# Start a worker by calling: Example.Worker.start_link(arg)
|
|
|
|
|
# {Example.Worker, arg}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
|
|
|
|
# for other strategies and supported options
|
|
|
|
|
opts = [strategy: :one_for_one, name: Example.Supervisor]
|
|
|
|
|
Supervisor.start_link(children, opts)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Tell Phoenix to update the endpoint configuration
|
|
|
|
|
# whenever the application is updated.
|
|
|
|
|
@impl true
|
|
|
|
|
def config_change(changed, _new, removed) do
|
|
|
|
|
ExampleWeb.Endpoint.config_change(changed, removed)
|
|
|
|
|
:ok
|
|
|
|
|
end
|
|
|
|
|
end
|