working on db logic
Some checks failed
CI/CD Pipeline / build (push) Failing after 3s

This commit is contained in:
2026-03-12 15:01:33 -06:00
parent 399eb9f93f
commit 4dc4814b2f
21 changed files with 573 additions and 256 deletions

View File

@@ -6,8 +6,9 @@ defmodule ElixirAi.Application do
def start(_type, _args) do
children = [
ElixirAiWeb.Telemetry,
ElixirAi.Repo,
{Task, fn -> ElixirAi.AiProvider.ensure_default_provider() end},
# Conditionally start Repo (skip in test environment)
repo_child_spec(),
default_provider_task(),
{Cluster.Supervisor,
[Application.get_env(:libcluster, :topologies, []), [name: ElixirAi.ClusterSupervisor]]},
{Phoenix.PubSub, name: ElixirAi.PubSub},
@@ -40,4 +41,21 @@ defmodule ElixirAi.Application do
ElixirAiWeb.Endpoint.config_change(changed, removed)
:ok
end
# Skip Repo and related tasks in test environment
defp repo_child_spec do
if Application.get_env(:elixir_ai, :env) == :test do
Supervisor.child_spec({Task, fn -> :ok end}, id: :skip_repo)
else
ElixirAi.Repo
end
end
defp default_provider_task do
if Application.get_env(:elixir_ai, :env) == :test do
Supervisor.child_spec({Task, fn -> :ok end}, id: :skip_default_provider)
else
{Task, fn -> ElixirAi.AiProvider.ensure_default_provider() end}
end
end
end