I am trying to configure goth through a custom module by loading credentials from the database.
Config.exs
config :goth, config_module: Glific.Goth
goth.exs
defmodule Glific.Goth do
use Goth.Config
import Ecto.Query
alias Glific.Repo
alias Glific.Partners.Provider
def init(config) do
credentials = Repo.one(from u in Provider, where: ilike(u.name, "GOTH"), select: u.secrets)
{:ok, Keyword.put(config, :json, credentials)}
end
end
I am getting (RuntimeError) could not lookup Ecto repo Repo because it was not started or it does not exist