defmodule OrgGarden.Application do @moduledoc """ OTP Application for org-garden. Starts core infrastructure services: - Finch HTTP client pool - Process registry for named lookups - DynamicSupervisor for runtime-started services - Health check HTTP server Service-mode components (Watcher, Quartz) are started dynamically via OrgGarden.Server when running in serve mode. """ use Application @impl true def start(_type, _args) do children = [ # HTTP client pool for Zotero/external requests {Finch, name: OrgGarden.Finch}, # Process registry for named lookups {Registry, keys: :unique, name: OrgGarden.Registry}, # Dynamic supervisor for serve mode components {DynamicSupervisor, name: OrgGarden.DynamicSupervisor, strategy: :one_for_one}, # Health check HTTP server {Bandit, plug: OrgGarden.Health, port: health_port(), scheme: :http} ] opts = [strategy: :one_for_one, name: OrgGarden.AppSupervisor] Supervisor.start_link(children, opts) end defp health_port do Application.get_env(:org_garden, :health_port, 9090) end end