Files
gerbeur/.env.example
khannurien c0d03e9aaa v4: users sign in to one gerbeur instance with their account on another — topic instances, each with its own admins, domain and data, had no way to share accounts. Sign-in is federated over a subset of OpenID Connect, the authorization code flow with PKCE: each instance is an identity provider for its own users and a client for the others', and signs what it tells them with an Ed25519 key kept in federation_keys and published at /.well-known/jwks.json, beside its metadata at /.well-known/openid-configuration. Only sign-in is federated: an account from another instance is a local users row linked to (issuer, subject) in user_identities, with no password (password_hash ''), so sessions, roles, permissions, the socket and every foreign key work as before.
A remote user is name@host here, in users.username, in paths (/@alice@music.example) and in mentions, through one handle rule in shared/validation.ts that paths, MENTION_RE and Markdown all build on; Markdown undoes GFM's email autolink of a handle. Their name, email and avatar come from their home at each sign-in and by its signed events (federation_outbox, delivered by the federation job with backoff): a rename at home leaves the old handle an alias here, and a password change or a withdrawn grant ends their sessions here. Their password, email, avatar and name can't change here (assertLocalUser), nor can they sign in elsewhere from here.

An admin keeps the trusted and blocked instances on /manage (federation:manage): a trusted instance's users sign in from a button on the login page, a blocked one's can't and are signed out at once, and any other's join with an invite from the register page. The /authorize page asks the user once per instance, and /settings lists the instances their account signs in to, each disconnectable; /login?next= brings a signed-out visitor back to /authorize. Emails stay unique among local accounts only, and migration 0024 adds the tables, makes that index partial and reserves authorize and federation as category slugs. remote/gerbeur-instance.ts is the only way to other instances: https and public addresses only, no redirects, no certificate fallback, unless GERBEUR_FEDERATION_ALLOW_PRIVATE lets two instances on one machine talk.

298 backend tests and 702 frontend tests pass, and deno check, deno fmt, deno lint, tsc, eslint, doc:lint and i18n:compile --strict are clean; checked end to end with two built instances on one machine: sign-in through the other's login and consent pages, consent skipped once granted and asked again after disconnecting, a rename and a password change at home reaching the other, and blocking; screenshots of the login, consent, profile, settings and manage pages at 1280 and 390px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 14:23:00 +00:00

95 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ── API server ────────────────────────────────────────────────────────────────
# Public-facing URL of the server. Used for CORS/WebSocket origin checks,
# email links, and OG image URLs. Behind a reverse proxy, set this to the
# externally-visible URL with no trailing slash (e.g. https://example.com).
# Defaults to http://localhost:GERBEUR_PORT for local development.
# GERBEUR_PUBLIC_URL=https://example.com
# Site name shown in the browser tab, app header, OG meta tags, and emails.
GERBEUR_SITE_NAME=gerbeur
# Emoji the favicon set (SVG, .ico, PNG 16–512, Apple touch icon) and the app
# header logo are generated/rendered from. Defaults to 🚚. Applied at runtime
# (server startup), so changing it only needs a restart — no rebuild.
GERBEUR_SITE_EMOJI=🚚
# How Bandcamp links are played.
# embed (default) the bandcamp.com iframe — cannot autoplay
# native resolve the page's mp3 streams and play them in gerbeur's
# own player: autoplay, seeking, and albums as a queue.
# Note this bypasses Bandcamp's player, so their play counts
# and 3-play preview limit do not apply.
# Applied at runtime; changing it needs a restart of both the API and Vite.
GERBEUR_BANDCAMP_PLAYER=embed
# Port the API server listens on (the container's internal port).
GERBEUR_PORT=8000
# Network interface Oak binds to. Default: 0.0.0.0 (all interfaces, required for Docker).
# Set to 127.0.0.1 to restrict to loopback only.
GERBEUR_LISTEN_HOST=0.0.0.0
# Base URL of the frontend, used in email links (e.g. password reset) and
# automatically added to the CORS/WebSocket allowed-origins list.
# Defaults to GERBEUR_PUBLIC_URL — correct for single-container deployments.
# In prod with a separate frontend host, set this to the frontend origin; that
# is the only variable you need for that case (no GERBEUR_ALLOWED_ORIGINS entry required).
# Example: https://app.example.com
# GERBEUR_FRONTEND_URL=
# Comma-separated list of *extra* origins allowed to reach the API/WS.
# GERBEUR_PUBLIC_URL and GERBEUR_FRONTEND_URL are always included automatically.
# Typically only needed in dev to whitelist the Vite dev server.
# Defaults to empty (no extra origins).
# Example: http://localhost:3000,http://127.0.0.1:3000
GERBEUR_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
# Secret key used to sign JWTs. Generate with: openssl rand -hex 32
GERBEUR_JWT_SECRET=
# SMTP connection URL for outgoing email: the welcome email, password reset
# links and the weekly/monthly digests. Leave empty to send no email at all.
# Example: smtps://username:password@smtp.example.com:465
GERBEUR_SMTPS_URL=
# Sender of every email, as an address or "Name <address>"
# (e.g. gerbeur <no-reply@example.com>).
# Required when GERBEUR_SMTPS_URL is set: the server refuses to start without it.
GERBEUR_FROM_EMAIL=
# Language of every email: en (default) or fr. The interface follows each
# visitor's browser, which the server never sees, so emails use the instance's.
GERBEUR_EMAIL_LOCALE=en
# The instance's style: smooth (default), brutalist, geocities, nyt, kanagawa
# or melange. Visitors and accounts see it until they pick one, and the welcome
# and password reset emails are drawn in it; a digest uses its reader's own
# style. Applied at runtime; changing it needs a restart of both the API and Vite.
GERBEUR_DEFAULT_STYLE=smooth
# How often, in minutes, the /community page's figures are recomputed.
GERBEUR_COMMUNITY_REFRESH_MINUTES=15
# Set to 1 to let federated sign-in reach other instances on private addresses
# (localhost included) and over plain http, so that two instances on one
# machine can trust each other in development. Never in production.
# GERBEUR_FEDERATION_ALLOW_PRIVATE=1
# Markdown body of the welcome email sent on account creation, replacing the
# built-in one (written in GERBEUR_EMAIL_LOCALE). Supports {{username}} and
# {{site_name}}. Use \n for line breaks in single-line .env values, or a
# quoted multiline block.
# GERBEUR_WELCOME_EMAIL_BODY="# Welcome to {{site_name}}!\n\nHi **{{username}}**,\n\nYour account has been created successfully. Welcome aboard!"
# ── Frontend (Vite) ───────────────────────────────────────────────────────────
# These must be prefixed with VITE_ to be exposed to the client bundle.
# Only needed when the API runs on a different host/port than the frontend.
# In standard dev (API on :8000, Vite on :3000) these are not required —
# the frontend automatically uses http://localhost:8000 in dev mode.
# In prod (single container) they are not used — the frontend uses relative URLs.
# Only set these when deploying the API and frontend on separate hosts.
# VITE_API_PROTOCOL=https
# VITE_API_HOSTNAME=api.example.com
# VITE_API_PORT=443