Configuration of Swoosh in an Umbrella app

When scaffolding an Umbrella app with Mix, the following swoosh configuration can be found in the global prod config file:

config :swoosh, :api_client, MyApp.Finch

However I have multiple apps, and don’t really understand why this is then global, and which Finch instance should be specified.

When I scaffold the different Umbrella apps, I’ll typically have multiple Finch clients started by default:

defmodule FooApp.Application do
  use Application

  def start(_type, _args) do
    children = [
      # ...
      {Finch, name: FooApp.Finch}
    ]
    Supervisor.start_link(children, strategy: :one_for_one, name: FooApp.Supervisor)
  end
end
defmodule BarApp.Application do
  use Application

  def start(_type, _args) do
    children = [
      # ...
      {Finch, name: BarApp.Finch}
    ]
    Supervisor.start_link(children, strategy: :one_for_one, name: BarApp.Supervisor)
  end
end

etcetera

Thank you for any help!

@sneako hope you don’t mind I ping you here, but should I just use a common name (:name option) for all the Finch children (in Application modules) in all umbrella apps?

What is the consequence of having different names vs common name for all umbrella apps? Note that all these apps may be deployed separately as those are umbrella apps.

Hi there! It should be fine to just use one global Finch instance or many if you prefer. I have an application at work in which we use multiple Finch instances mainly so that we can use different configuration for the default pools.