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:
@@ -24,6 +24,13 @@ config :music_library, MusicLibraryWeb.Endpoint,
|
||||
pubsub_server: MusicLibrary.PubSub,
|
||||
live_view: [signing_salt: "g/qw4SNo"]
|
||||
|
||||
config :music_library, LastFm,
|
||||
# to avoid runtime errors, set the user to a valid Last.fm username
|
||||
user: "username",
|
||||
api: LastFm.APIImpl,
|
||||
refresh_interval: System.convert_time_unit(60, :second, :millisecond),
|
||||
api_key: "change me"
|
||||
|
||||
# Configure esbuild (the version is required)
|
||||
config :esbuild,
|
||||
version: "0.17.11",
|
||||
|
||||
@@ -62,6 +62,9 @@ config :music_library, MusicLibraryWeb.Endpoint,
|
||||
# Enable dev routes for dashboard and mailbox
|
||||
config :music_library, dev_routes: true
|
||||
|
||||
config :music_library, LastFm,
|
||||
refresh_interval: System.convert_time_unit(500, :second, :millisecond)
|
||||
|
||||
# Do not include metadata nor timestamps in development logs
|
||||
config :logger, :console, format: "[$level] $message\n"
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@ if api_key = System.get_env("LAST_FM_API_KEY") do
|
||||
config :music_library, LastFm, api_key: api_key
|
||||
end
|
||||
|
||||
if user = System.get_env("LAST_FM_USER") do
|
||||
config :music_library, LastFm, user: user
|
||||
end
|
||||
|
||||
if config_env() == :prod do
|
||||
database_path =
|
||||
System.get_env("DATABASE_PATH") ||
|
||||
|
||||
+1
-1
@@ -28,4 +28,4 @@ config :phoenix, :plug_init_mode, :runtime
|
||||
config :phoenix_live_view,
|
||||
enable_expensive_runtime_checks: true
|
||||
|
||||
config :music_library, :last_fm, nil
|
||||
config :music_library, LastFm, api: nil
|
||||
|
||||
Reference in New Issue
Block a user