How do I set permissions for Guardian from a DB table. In my app users can create tables in the database and I need a way update or provide the base permissions for Guardian at runtime

Problem Statement

I tried to get the permissions structured correctly for Guardian in my Guardian module like so.

defmodule Dynamic.Guardian do

  alias Dynamic.BaseContent
  alias Dynamic.BaseStructures
  alias Dynamic.Repo

  use Guardian, otp_app: :dynamic,
    permissions: BaseStructures.get_table_permissions!()

However I get this error:

(RuntimeError) could not lookup Ecto repo Dynamic.Repo because it was not started or it does not exist

  │ (ecto 3.8.4) lib/ecto/repo/registry.ex:22: Ecto.Repo.Registry.lookup/1
  │ (ecto 3.8.4) lib/ecto/repo/supervisor.ex:159: Ecto.Repo.Supervisor.tuplet/2
  │ (dynamic 0.1.0) lib/dynamic/repo.ex:2: Dynamic.Repo.all/2
  │ (dynamic 0.1.0) lib/dynamic/base_structures.ex:145: Dynamic.BaseStructures.get_table_permissions!/0
  │ lib/dynamic/guardian.ex:9: (module)Elixir

Solution Brainstorm

Any thoughts on how to support this or if Im in fact missing something fundamental.