The store now starts empty and agents are added/removed exclusively through the web admin page / admin API, persisted to AGENTS_FILE. No AGENTS env var needed in the sops secret.
26 lines
892 B
Elixir
26 lines
892 B
Elixir
defmodule N8nOpenaiAdapter.Application do
|
|
@moduledoc """
|
|
OTP application entrypoint. Starts the AgentRegistry (model -> n8n webhook
|
|
mapping, loaded from config) and the Bandit HTTP server behind the Plug router.
|
|
"""
|
|
use Application
|
|
|
|
@impl true
|
|
def start(_type, _args) do
|
|
children = [
|
|
{N8nOpenaiAdapter.AgentRegistry, configured_agents()},
|
|
{Bandit, plug: N8nOpenaiAdapter.Router, scheme: :http, port: port()}
|
|
]
|
|
|
|
opts = [strategy: :one_for_one, name: N8nOpenaiAdapter.Supervisor]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
defp port, do: String.to_integer(System.get_env("PORT", "8000"))
|
|
|
|
# Agents are managed at runtime via the admin API and persisted to AGENTS_FILE.
|
|
# We start with an empty store (no AGENTS env seeding) — the web admin is the
|
|
# single source of truth for which agents are exposed.
|
|
defp configured_agents, do: %{}
|
|
end
|