Use LastFm.Config where needed
This commit is contained in:
@@ -15,7 +15,7 @@ defmodule MusicLibrary.Application do
|
||||
{DNSCluster, query: Application.get_env(:music_library, :dns_cluster_query) || :ignore},
|
||||
{Phoenix.PubSub, name: MusicLibrary.PubSub},
|
||||
MusicBrainz.Supervisor,
|
||||
{LastFm.Supervisor, last_fm_config()},
|
||||
{LastFm.Supervisor, LastFm.Config.resolve(:music_library)},
|
||||
# Start a worker by calling: MusicLibrary.Worker.start_link(arg)
|
||||
# {MusicLibrary.Worker, arg},
|
||||
# Start to serve requests, typically the last entry
|
||||
@@ -40,9 +40,4 @@ 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)
|
||||
|> LastFm.Config.new()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -111,7 +111,7 @@ defmodule MusicLibrary.Records do
|
||||
end
|
||||
|
||||
def get_artist_info(musicbrainz_id) do
|
||||
last_fm().get_artist_info(musicbrainz_id, last_fm_api_key())
|
||||
last_fm().get_artist_info(musicbrainz_id, last_fm_config())
|
||||
end
|
||||
|
||||
def get_cover(id) do
|
||||
@@ -224,8 +224,5 @@ defmodule MusicLibrary.Records do
|
||||
Application.get_env(:music_library, :last_fm, LastFm.APIImpl)
|
||||
end
|
||||
|
||||
defp last_fm_api_key do
|
||||
Application.get_env(:music_library, LastFm)
|
||||
|> Keyword.fetch!(:api_key)
|
||||
end
|
||||
defp last_fm_config, do: LastFm.Config.resolve(:music_library)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user