144 lines
4.7 KiB
Elixir
144 lines
4.7 KiB
Elixir
# This file is responsible for configuring your application
|
|
# and its dependencies with the aid of the Config module.
|
|
#
|
|
# This configuration file is loaded before any dependency and
|
|
# is restricted to this project.
|
|
|
|
# General application configuration
|
|
import Config
|
|
|
|
config :elixir, :time_zone_database, TimeZoneInfo.TimeZoneDatabase
|
|
|
|
config :time_zone_info, update: :daily
|
|
|
|
config :music_library,
|
|
ecto_repos: [MusicLibrary.BackgroundRepo, MusicLibrary.Repo],
|
|
generators: [timestamp_type: :utc_datetime, binary_id: true]
|
|
|
|
config :music_library, default_timezone: "Europe/London"
|
|
|
|
config :music_library, :similarity, max_distance: 0.45
|
|
|
|
config :music_library, :pagination,
|
|
default_page_size: 20,
|
|
stats_limit: 30,
|
|
top_items_limit: 10,
|
|
tracks_page_size: 200,
|
|
search_preview_limit: 5
|
|
|
|
config :music_library, MusicLibraryWeb,
|
|
login_password: "change me",
|
|
api_token: "change me"
|
|
|
|
# Configures the endpoint
|
|
config :music_library, MusicLibraryWeb.Endpoint,
|
|
url: [host: "localhost"],
|
|
adapter: Bandit.PhoenixAdapter,
|
|
render_errors: [
|
|
formats: [html: MusicLibraryWeb.ErrorHTML, json: MusicLibraryWeb.ErrorJSON],
|
|
layout: false
|
|
],
|
|
pubsub_server: MusicLibrary.PubSub,
|
|
live_view: [signing_salt: "g/qw4SNo"]
|
|
|
|
user_agent = "MusicLibrary/0.1.0 ( cloud8421@gmail.com )"
|
|
|
|
config :music_library, LastFm,
|
|
user: "username",
|
|
auto_refresh: true,
|
|
# refresh every 5 minutes
|
|
refresh_interval: System.convert_time_unit(300, :second, :millisecond),
|
|
api_key: "change me",
|
|
shared_secret: "change me",
|
|
user_agent: user_agent
|
|
|
|
config :music_library, MusicBrainz, user_agent: user_agent
|
|
|
|
config :music_library, Discogs, personal_access_token: "change me", user_agent: user_agent
|
|
|
|
config :music_library, Wikipedia, user_agent: user_agent
|
|
|
|
config :music_library, BraveSearch, api_key: "change me", user_agent: user_agent
|
|
|
|
# Configure esbuild (the version is required)
|
|
config :esbuild,
|
|
version: "0.27.3",
|
|
music_library: [
|
|
args:
|
|
~w(js/app.js --bundle --target=es2022 --outdir=../priv/static/assets --external:/fonts/* --external:/images/* --alias:@=.),
|
|
cd: Path.expand("../assets", __DIR__),
|
|
env: %{"NODE_PATH" => [Path.expand("../deps", __DIR__), Mix.Project.build_path()]}
|
|
]
|
|
|
|
# Configure tailwind (the version is required)
|
|
config :tailwind,
|
|
version: "4.2.1",
|
|
music_library: [
|
|
args: ~w(
|
|
--input=assets/css/app.css
|
|
--output=priv/static/assets/app.css
|
|
),
|
|
cd: Path.expand("..", __DIR__)
|
|
]
|
|
|
|
# Configures Elixir's Logger
|
|
config :logger, :default_formatter,
|
|
format: "$time $metadata[$level] $message\n",
|
|
metadata: [:request_id]
|
|
|
|
# Use JSON for JSON parsing in Phoenix
|
|
config :phoenix, :json_library, JSON
|
|
|
|
config :music_library, Oban,
|
|
engine: Oban.Engines.Lite,
|
|
queues: [default: 10, heavy_writes: 1, music_brainz: 1, discogs: 1, wikipedia: 1],
|
|
repo: MusicLibrary.BackgroundRepo,
|
|
plugins: [
|
|
{Oban.Plugins.Cron,
|
|
crontab: [
|
|
# every 12 hours
|
|
{"0 */12 * * *", MusicLibrary.Worker.ApplyScrobbleRules},
|
|
{"0 */12 * * *", MusicLibrary.Worker.PruneAssetCache},
|
|
# every day at 2 am,
|
|
{"0 2 * * *", MusicLibrary.Worker.PruneAssets},
|
|
# every day at 3 am,
|
|
{"0 3 * * *", MusicLibrary.Worker.RepoVacuum},
|
|
# every day at 4 am,
|
|
{"0 4 * * *", MusicLibrary.Worker.RepoOptimize},
|
|
# every first day of the month, staggered hourly
|
|
{"0 6 1 * *", MusicLibrary.Worker.RecordRefreshAllMusicBrainzData},
|
|
{"0 7 1 * *", MusicLibrary.Worker.RecordGenerateAllEmbeddings},
|
|
{"0 8 1 * *", MusicLibrary.Worker.ArtistRefreshAllMusicBrainzData},
|
|
{"0 9 1 * *", MusicLibrary.Worker.ArtistRefreshAllDiscogsData},
|
|
{"0 10 1 * *", MusicLibrary.Worker.ArtistRefreshAllWikipediaData}
|
|
]}
|
|
]
|
|
|
|
# Timing metrics (execution time, queue time) are stored in space-efficient
|
|
# quantile sketches. By default, values are recorded in `:native` time units
|
|
# (nanoseconds on most systems), which provides maximum precision but uses more
|
|
# space.
|
|
# For reduced storage size (~20% smaller) and better bin consolidation, we
|
|
# configure sketches to store timing in millisecond
|
|
config :oban_met, sketch_time_unit: :millisecond
|
|
|
|
config :music_library, MusicLibrary.BackgroundRepo, priv: "priv/background_repo"
|
|
|
|
config :fluxon, :translate_function, &MusicLibraryWeb.CoreComponents.translate_error/1
|
|
|
|
config :sentry,
|
|
client: Sentry.FinchClient,
|
|
environment_name: config_env(),
|
|
enable_source_code_context: true,
|
|
root_source_code_paths: [File.cwd!()]
|
|
|
|
config :honeybadger,
|
|
app: :music_library,
|
|
environment_name: config_env(),
|
|
# Enable logging and performance insights
|
|
insights_enabled: true
|
|
|
|
# Import environment specific config. This must remain at the bottom
|
|
# of this file so it overrides the configuration defined above.
|
|
import_config "#{config_env()}.exs"
|