Files
chess-endgame-trainer/config/config.exs
T

145 lines
5.2 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",
discord_invite: "https://discord.gg/Z2NfkG7thV"
# 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
# Puzzle selection. Difficulty is a weighted bias towards a target rating —
# `medium` targets the user's rating, `easy` 200 below it and `hard` 200 above
# it — and `spread` is how many rating points it takes for a puzzle's chance to
# fall off by a factor of e. `repeat_window_days` is how long an attempted
# puzzle stays out of the pool. Tweak `spread` to widen or narrow the served
# difficulty (e.g. 100 or 250).
config :chesstrainer, :puzzles,
spread: 150,
repeat_window_days: 30,
targets: [easy: -200, medium: 0, hard: 200]
# 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"