Refactor last_fm configuration

Move all configuration outside of the LastFm module, so that it's not
polluted with references to the parent music_library application.
This commit is contained in:
Claudio Ortolina
2024-11-06 12:08:06 +00:00
parent c64a8f7287
commit 18ae8b7866
11 changed files with 33 additions and 24 deletions
+5 -1
View File
@@ -15,7 +15,7 @@ defmodule MusicLibrary.Application do
repos: Application.fetch_env!(:music_library, :ecto_repos), skip: skip_migrations?()},
{DNSCluster, query: Application.get_env(:music_library, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: MusicLibrary.PubSub},
LastFm.Supervisor,
{LastFm.Supervisor, last_fm_config()},
# Start a worker by calling: MusicLibrary.Worker.start_link(arg)
# {MusicLibrary.Worker, arg},
# Start to serve requests, typically the last entry
@@ -40,4 +40,8 @@ defmodule MusicLibrary.Application do
# By default, sqlite migrations are run when using a release
System.get_env("RELEASE_NAME") != nil
end
defp last_fm_config do
Application.get_env(:music_library, LastFm)
end
end