Files
usaco/site/.env.example
T
adamfandClaude Opus 5.5 995b44a57a
Test and publish the site / publish (push) Successful in 8m15s
Test and publish the site / test (push) Successful in 5m51s
Add an Explain button that has Claude explain a problem
When stuck, the admin can ask Claude for an intuitive explanation of a
problem. It is committed as explain.md and shown as folded sections, so
the reader opens only as much as they need: the key observation, hints
that get stronger, the approach, a walkthrough with an SVG diagram per
step, complexity, pitfalls and a pseudocode sketch.

- internal/claude: streamed call with a JSON-schema reply, high effort,
  the server-side refusal fallback, fixed error messages and logged
  token usage. CLAUDE_API_KEY and CLAUDE_MODEL (default claude-opus-5-5);
  without a key only this feature is off.
- internal/explain: the prompt, the schema, rendering to markdown, and
  a per-problem job tracker. The request starts a job and the page polls,
  since a call outlasts nginx's 120s timeout.
- internal/statement: fetches statements from LeetCode's GraphQL API and
  USACO's problem pages. Others (Codeforces is behind Cloudflare) are
  pasted.
- problem.md holds the statement, editable from the meta editor and
  shown only to the admin. Diagrams are sanitized with DOMPurify.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 20:38:15 +01:00

50 lines
1.9 KiB
Bash

# Every variable the server reads. In production these are set by the main
# site's docker-compose.yml (see README.md); for standalone development,
# docker-compose.yml here sets what it needs.
# --- Core -------------------------------------------------------------------
# URL prefix everything is served under. The SPA is built for /usaco.
BASE_PATH=
# The clone lives in $DATA_DIR/repo (default /data).
DATA_DIR=
# Listen port (default 8080).
PORT=
# "true" enables gin debug logging, and is required for AUTH_MODE=dev.
DEV_MODE=
# --- Git --------------------------------------------------------------------
# What to clone. Production: http://gitea:3000/adamf/usaco.git (Gitea on the
# Docker network). Required.
GIT_REMOTE_URL=
# Default main.
GIT_BRANCH=
# HTTP credentials: a Gitea access token with read and write on the repo.
# Given to git through GIT_ASKPASS, never written into .git/config.
# GIT_USER defaults to adamf.
GIT_USER=
GIT_TOKEN=
# Who the site's commits are by. Defaults: "usaco site" / [email protected].
GIT_AUTHOR_NAME=
GIT_AUTHOR_EMAIL=
# "false" keeps edits as local commits (development). Default true.
GIT_PUSH=
# Fallback pull interval, a Go duration. Default 10m; the webhook is the
# normal trigger.
PULL_INTERVAL=
# Shared secret of the Gitea push webhook. Blank turns the hook off.
WEBHOOK_SECRET=
# --- Auth -------------------------------------------------------------------
# "forward" (default): ask the main site's backend. "dev": admit everyone.
AUTH_MODE=
# The site backend's validate-admin route, on the Docker network
# (default http://backend:8080/auth/validate-admin).
AUTH_VALIDATE_URL=
# --- Claude -----------------------------------------------------------------
# API key for the Explain button. Blank turns explanations off; the rest of
# the site is unaffected.
CLAUDE_API_KEY=
# Model for explanations (default claude-opus-5-5).
CLAUDE_MODEL=