Lets a deployment configure the server through the GERBEUR_* environment
variables, which it reads once at import, and holds the fixed limits the
backend applies. The deno tasks load .env with --env-file, so changing a
setting needs a restart.
How the frontend plays Bandcamp. "embed" uses Bandcamp's iframe, which
can't autoplay. "native" resolves the page's streams through
GET /api/bandcamp/tracks and plays them in the app's player, which
autoplays and queues an album's tracks.
The origins that CORS in main.ts and the WebSocket route accept. They are
PUBLIC_URL, FRONTEND_URL and the comma-separated
GERBEUR_ALLOWED_ORIGINS.
Holds the images pasted into chat messages, comments, dump notes and descriptions. The startup tasks purge those nothing links to.
Holds each user's avatar.
How the frontend plays Bandcamp (GERBEUR_BANDCAMP_PLAYER), passed to it in
index.html. Any value but "native" means "embed", so a typo falls back to
the player that always works.
How often, in minutes, the /community page's figures are recomputed
(GERBEUR_COMMUNITY_REFRESH_MINUTES), 15 by default.
The SQLite database file (GERBEUR_DB_PATH). api/test/setup.ts points it at
a throwaway file before anything opens the database.
The instance's style (GERBEUR_DEFAULT_STYLE). The site shows it until a
visitor or their account picks one, through index.html, and the emails that
aren't a user's own (the welcome and the password reset) are drawn in it. A
value that isn't a style means BASE_STYLE.
The MIME type prefixes a file dump may have. dump-service also accepts the exact types of DUMP_ALLOWED_MIME_TYPES.
The documents and archives a file dump may be, beyond the prefixes.
Holds the file of each file dump.
Whether the instance sends email, which is whether SMTPS_URL is
set. email-service.ts opens its transport by it, and index.html tells the
client, whose settings show the digest switches disabled without it.
The language of every email (GERBEUR_EMAIL_LOCALE). The interface picks
each visitor's language in their browser, which the server never learns, so
the emails take the instance's. A value that isn't a locale means the
source one, English.
Which ways federated sign-in goes, each on unless set to 0.
Lets federated sign-in reach instances on private addresses, localhost
among them, and over plain http (GERBEUR_FEDERATION_ALLOW_PRIVATE=1), so
that two instances on one machine can trust each other in development.
Off, remote/gerbeur-instance.ts reaches only public https instances, since
an identity is only as safe as the connection it came over.
The From address of every email (GERBEUR_FROM_EMAIL), as an address or
as Name <address>. email-service.ts refuses to load without it when
SMTPS_URL is set.
Points password reset links and the Open Graph tags' page URLs at the
frontend when it isn't served from PUBLIC_URL, as with a separate
Vite server, and allows it as an origin. It is GERBEUR_FRONTEND_URL,
without a trailing slash.
The key lib/jwt.ts signs and verifies tokens with (GERBEUR_JWT_SECRET).
The server refuses to start without it.
The interface the server binds to (GERBEUR_LISTEN_HOST). The default,
0.0.0.0, lets Docker forward the port; 127.0.0.1 keeps it to loopback.
Caps the size of an image upload, in bytes, for avatars, covers, thumbnails and attachments. lib/upload.ts states it in megabytes in its error.
The site's name (GERBEUR_SITE_NAME). It is filled into index.html, the OG
tags, the icons' manifest and the emails.
How long an attachment nothing links to is kept before startup purges it.
The page size when a request names none.
The largest page size a request may ask for.
Holds each playlist's cover.
The port the server listens on (GERBEUR_PORT, default 8000).
The URL visitors reach the server at (GERBEUR_PUBLIC_URL), without a
trailing slash. Behind a reverse proxy it must be the outside URL: it is an
allowed origin, it tells links to this site's own pages from other links,
and it prefixes the image URLs in their previews.
Holds the scaled-down copies of the images above, which lib/ffmpeg.ts makes as they are first asked for, each at its upload's path with its width. It can be emptied at any time: the copies are made again.
The emoji that serves as the site's logo (GERBEUR_SITE_EMOJI). The icons
script draws the favicons from it, and index.html carries it to the app's
header, so changing it needs a restart but no rebuild.
The smtps:// URL of the server email-service.ts sends mail through
(GERBEUR_SMTPS_URL). When it is empty, no email is sent: sign-up sends no
welcome, a password reset request does nothing, and there are no digests.
The background of the generated Apple touch icon, the manifest's colors, and
the accent of previews of this site's own pages. index.html's theme-color
tags don't follow it.
Holds the thumbnails a poster uploads (<id>-custom) and those the
thumbnails route generates from file dumps.
How long an invite stays usable. invite-service refuses an older one, and the startup tasks purge it.
The directory uploads are stored under (GERBEUR_UPLOADS_DIR). Each kind has
its subdirectory below, created by the first upload, and each file is named
after the id of what it belongs to.
The Markdown of the welcome email sent on registration
(GERBEUR_WELCOME_EMAIL_BODY), or null for the built-in one in the
EMAIL_LOCALE. api/mail/welcome.ts replaces {{site_name}} and
{{username}} in it.
Usage
import * as mod from "api/config.ts";