Supabase.ClientSupervisor (supabase_potion v0.3.6)

A supervisor for all Clients. In most cases this should be started automatically by the application supervisor and be used mainly by the Supabase module, available on :supabase_potion application.

Although if you want to manage Clients manually, you can leverage this module to start and stop Clients dynamically. To start the supervisor manually, you need to add it to your supervision tree:

defmodule MyApp.Application do
  use Application

  def start(_type, _args) do
    children = [
      {Supabase.ClientSupervisor, []}
    ]

    opts = [strategy: :one_for_one, name: MyApp.Supervisor]
    Supervisor.start_link(children, opts)
  end
end

And then use the Supervisor to start custom clients:

iex> Supabase.ClientSupervisor.start_child({Supabase.Client, opts})
{:ok, #PID<0.123.0>}

Notice that the Supabase Elixir SDK already starts a Supabase.ClientSupervisor internally, so you don't need to start it manually. However, if you want to manage clients manually, you can leverage this module to start and stop clients dynamically.

To manage manually the clients, you need to disable the internal management into your application:

config :supabase, :manage_clients, false

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

Link to this function

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_child(child_spec)

Link to this function

start_link(init)