Current section
Files
Jump to
Current section
Files
lib/hermes/application.ex
defmodule Hermes.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
:logger.add_handlers(:hermes_mcp)
children =
[
{Finch, name: Hermes.Finch, pools: %{default: [size: 15]}}
] ++ if Mix.env() == :test, do: [Hermes.Server.Registry], else: []
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Hermes.Supervisor]
{:ok, pid} = Supervisor.start_link(children, opts)
if Hermes.should_compile_cli?() do
with {:module, cli} <- Code.ensure_loaded(Hermes.CLI), do: cli.main()
{:ok, pid}
else
{:ok, pid}
end
end
end