Extract config for MusicBrainz

This commit is contained in:
Claudio Ortolina
2024-12-04 10:33:41 +00:00
parent 14518870a0
commit 7575e5978a
5 changed files with 32 additions and 13 deletions
+16
View File
@@ -0,0 +1,16 @@
defmodule MusicBrainz.Config do
@type t :: %{
api: module(),
user_agent: String.t()
}
defstruct api: MusicBrainz.APIImpl,
user_agent: "change me"
@spec resolve(atom) :: t
def resolve(otp_app) do
app_config = Application.get_env(otp_app, MusicBrainz)
struct(__MODULE__, app_config)
end
end