mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Read the local Syzygy directory from TABLEBASE_PATH so a dev machine and a VPS can point at their own copies. Add mix tablebase.fetch (downloads the 3/4/5 WDL+DTZ set, resumable) and mix tablebase.check (verifies it loads), plus a boot log reporting whether local tablebases are ready and the largest piece count. Covers the codeable part of #31; installing on the VPS and setting TABLEBASE_PATH there remains a manual step.
41 lines
1.4 KiB
Elixir
41 lines
1.4 KiB
Elixir
defmodule Chesstrainer.Application do
|
|
# See https://elixir.hexdocs.pm/Application.html
|
|
# for more information on OTP Applications
|
|
@moduledoc false
|
|
|
|
use Application
|
|
|
|
@impl true
|
|
def start(_type, _args) do
|
|
cache_opts = Application.get_env(:chesstrainer, Chesstrainer.Cache, [])
|
|
|
|
children = [
|
|
ChesstrainerWeb.Telemetry,
|
|
Chesstrainer.Repo,
|
|
{DNSCluster, query: Application.get_env(:chesstrainer, :dns_cluster_query) || :ignore},
|
|
{Phoenix.PubSub, name: Chesstrainer.PubSub},
|
|
# Start a worker by calling: Chesstrainer.Worker.start_link(arg)
|
|
# {Chesstrainer.Worker, arg},
|
|
# Start to serve requests, typically the last entry
|
|
ChesstrainerWeb.Endpoint,
|
|
{Registry, keys: :unique, name: Chesstrainer.CacheRegistry},
|
|
{Task.Supervisor, name: Chesstrainer.Cache.BackupSupervisor},
|
|
{Chesstrainer.Cache, {:tablebase, cache_opts}},
|
|
Chesstrainer.Endgames.Tablebase.Local
|
|
]
|
|
|
|
# See https://elixir.hexdocs.pm/Supervisor.html
|
|
# for other strategies and supported options
|
|
opts = [strategy: :one_for_one, name: Chesstrainer.Supervisor]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
# Tell Phoenix to update the endpoint configuration
|
|
# whenever the application is updated.
|
|
@impl true
|
|
def config_change(changed, _new, removed) do
|
|
ChesstrainerWeb.Endpoint.config_change(changed, removed)
|
|
:ok
|
|
end
|
|
end
|