Files
chess-endgame-trainer/lib/chesstrainer/application.ex
T
owenrees dda588da06 Feature/guest trainer (#89)
* add anonymous guest training with a daily puzzle limit

- /guest-train serves random endgames with no difficulty picker; signed-in
  visitors are redirected to /train
- guests get 5 puzzles per UTC day, keyed by an in-memory HMAC of the client
  address; the raw address is never stored or logged
- a sign-up wall replaces the next puzzle once the budget is spent
- move the endgame library behind auth so guests cannot browse it
- privacy disclosure tracked in #87

* remove chess-test endpoint and liveview
2026-11-06 12:06:32 +01:00

42 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},
Chesstrainer.GuestLimits,
# 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