Files
chess-endgame-trainer/config/config.exs
T
owenrees 37e0ac8e56 Transactional mail, crawler metadata, and asset measurement (#179)
* Send transactional email from no-reply@mail.innersquare.app

Centralise the sender identity, reply-to address and SES configuration set in Chesstrainer.Mail so no notifier can drift. Add MAIL_REDIRECT_TO for smoke tests and a mix mail.check task that exercises the SES mailbox simulators, and document the setup in the deploy guide and .env.example.

* Tighten crawler metadata and keep play pages out of search

Canonical URLs no longer carry query strings, public pages get an OG image, WebSite JSON-LD and a per-page language, and the sitemap dates the landing page only. Play and guest-training routes are marked noindex so tens of thousands of near-identical pages stay out of the index.

* Measure built asset sizes with mix assets.sizes

Report raw, gzip and brotli sizes for built JS and CSS, and record the current numbers plus the board-code split recommendation in docs/assets.md.
2026-11-17 10:29:45 +01:00

139 lines
4.9 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
# Public-facing branding. Change these values to rename the site without
# touching templates. The OTP app (`:chesstrainer`) and module namespaces are
# identity, not branding, and stay as they are.
config :chesstrainer, :branding,
name: "Inner Square Chess",
wordmark: "INNERSQUARE",
tagline: "Endgame Trainer",
support_email: "support@innersquare.app",
mail_from: "no-reply@mail.innersquare.app"
# Prelaunch gating. Production sets these from PRELAUNCH and
# MAILING_LIST_ENABLED; dev and test use these defaults.
config :chesstrainer, :prelaunch, false
config :chesstrainer, :mailing_list_enabled, true
config :chesstrainer, :scopes,
user: [
default: true,
module: Chesstrainer.Accounts.Scope,
assign_key: :current_scope,
access_path: [:user, :id],
schema_key: :user_id,
schema_type: :binary_id,
schema_table: :users,
test_data_fixture: Chesstrainer.AccountsFixtures,
test_setup_helper: :register_and_log_in_user
]
config :chesstrainer,
ecto_repos: [Chesstrainer.Repo],
generators: [timestamp_type: :utc_datetime]
# Password-login throttle. Failures are counted in fixed windows for each
# client address and each normalised login. The address bucket is deliberately
# wider so one account stays protected from distributed guessing while one
# address cannot spray many accounts.
config :chesstrainer, ChesstrainerWeb.LoginThrottle,
window_ms: :timer.minutes(15),
max_per_login: 5,
max_per_ip: 10,
confirmation_cooldown_ms: :timer.minutes(15)
# Glicko rating system.
#
# `system_constant` is the volatility constraint passed through to the Glicko
# package. `window_days` is the minimum gap before replaying the same
# user/endgame pair may change either rating again. `rd_inflation_c` widens a
# rating deviation by sqrt(c^2 * days) while that side is inactive, capped at
# the Glicko maximum (350).
config :chesstrainer, :ratings,
system_constant: 0.8,
window_days: 7,
rd_inflation_c: 10.0
# Difficulty bands for puzzle sessions. An endgame is "medium" when its rating
# falls within `band_width` of the user's rating, "easy" below that band and
# "hard" above it. Tweak to widen or narrow the served difficulty (e.g. 150 or
# 200).
config :chesstrainer, :puzzles, band_width: 100
# Public codes of the endgames pinned to the landing-page puzzle grid, in
# display order. When empty (or short) the grid is topped up with a date-seeded
# selection from the database, so it stays stable for a given day.
config :chesstrainer, :curated_endgame_codes, []
# Configure the endpoint
config :chesstrainer, ChesstrainerWeb.Endpoint,
url: [host: "localhost"],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: ChesstrainerWeb.ErrorHTML, json: ChesstrainerWeb.ErrorJSON],
layout: false
],
pubsub_server: Chesstrainer.PubSub,
live_view: [signing_salt: "u0HD4N5a"]
# Configure LiveView
config :phoenix_live_view,
# the attribute set on all root tags. Used for Phoenix.LiveView.ColocatedCSS.
root_tag_attribute: "phx-r"
# Configure the mailer
#
# By default it uses the "Local" adapter which stores the emails
# locally. You can see the emails in your browser, at "/dev/mailbox".
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :chesstrainer, Chesstrainer.Mailer, adapter: Swoosh.Adapters.Local
# Configure esbuild (the version is required)
config :esbuild,
version: "0.25.4",
chesstrainer: [
args:
~w(js/app.js js/marketing.js --bundle --target=es2022 --outdir=../priv/static/assets/js --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.3.0",
chesstrainer: [
args: ~w(
--input=assets/css/app.css
--output=priv/static/assets/css/app.css
),
cd: Path.expand("..", __DIR__),
env: %{"NODE_PATH" => [Path.expand("../deps", __DIR__), Mix.Project.build_path()]}
]
# Configure the tablebase cache: maximum entries and the UTC time of the daily
# backup. Both can be overridden with environment variables at runtime.
config :chesstrainer, Chesstrainer.Cache,
max_size: 100_000,
backup_time: {3, 0}
# Configure Elixir's Logger
config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
# 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"