Don't load Last.fm credentials from env in test

This commit is contained in:
Claudio Ortolina
2025-05-07 11:05:03 +01:00
parent 952d3388a1
commit 790a7db3d7
2 changed files with 15 additions and 13 deletions
+14 -12
View File
@@ -20,18 +20,6 @@ if System.get_env("PHX_SERVER") do
config :music_library, MusicLibraryWeb.Endpoint, server: true
end
if api_key = System.get_env("LAST_FM_API_KEY") do
config :music_library, LastFm, api_key: api_key
end
if shared_secret = System.get_env("LAST_FM_SHARED_SECRET") do
config :music_library, LastFm, shared_secret: shared_secret
end
if user = System.get_env("LAST_FM_USER") do
config :music_library, LastFm, user: user
end
if openai_key = System.get_env("OPENAI_KEY") do
config :music_library, OpenAI, api_key: openai_key
end
@@ -64,6 +52,20 @@ config :music_library, MusicLibrary.Vault,
tag: "AES.GCM.V1", key: Base.decode64!(cloak_encryption_key), iv_length: 12}
]
if config_env() !== :test do
if api_key = System.get_env("LAST_FM_API_KEY") do
config :music_library, LastFm, api_key: api_key
end
if shared_secret = System.get_env("LAST_FM_SHARED_SECRET") do
config :music_library, LastFm, shared_secret: shared_secret
end
if user = System.get_env("LAST_FM_USER") do
config :music_library, LastFm, user: user
end
end
if config_env() == :prod do
database_path =
System.get_env("DATABASE_PATH") ||