import { defineEnvVars } from '@sveltejs/kit/env'; /** * A fresh install boots with nothing configured: `docker run -p 3000:3000`, then * claim the instance. Only the database location has a default; the container * entry point generates the signing secret on first start. * * `ORIGIN` stays optional so a bare container works, and so does a proxy that * forwards `Host`: unset, each request supplies its own origin. */ export const variables = defineEnvVars({ DATABASE_URL: { // Kept out of the source tree, so a database write never looks like a source // edit to the watcher. A container sets a path under its data volume. schema: (value) => (value === undefined || value === '' ? 'data/dev.db' : value), description: 'The SQLite database path, with an optional `file:` prefix.' }, ORIGIN: { schema: (value) => (value === undefined || value === '' ? undefined : value), description: 'The public base URL of this instance, for example `https://fable.example.com`. Leave it empty to use the address each request arrives on. Reset links and passkeys use it when it is set.' }, INSTANCE_ORIGIN: { schema: (value) => (value === undefined || value === '' ? undefined : value), description: 'The one address this instance advertises, for example `https://fable.example.com`. Passkeys bind to it and a reset link carries it. Used only when `ORIGIN` is empty, for an instance that answers on several domains.' }, BETTER_AUTH_SECRET: { schema: (value) => { if (value === undefined || value === '') return undefined; return value; }, description: 'Secret used to sign session cookies. The container generates one on first start if this is empty. Use 32 or more random characters.' }, /* * Mail is optional. Without `SMTP_HOST`, a reset link goes to the server log * and an admin sets the password from the accounts screen. */ SMTP_HOST: { schema: (value) => (value === undefined || value === '' ? undefined : value), description: 'The SMTP server that sends reset mail. Leave it empty to send no mail.' }, SMTP_PORT: { schema: (value) => { if (value === undefined || value === '') return 587; const port = Number(value); if (!Number.isInteger(port) || port < 1 || port > 65535) { throw new Error('SMTP_PORT must be a whole number between 1 and 65535.'); } return port; }, description: 'The SMTP port. 587 submits with STARTTLS, 465 uses TLS from the start.' }, SMTP_SECURE: { schema: (value) => value === 'true' || value === '1', description: 'Set to `true` when the SMTP port expects TLS immediately, as 465 does.' }, SMTP_USER: { schema: (value) => (value === undefined || value === '' ? undefined : value), description: 'The SMTP username. Leave it empty for a relay that needs no login.' }, SMTP_PASSWORD: { schema: (value) => (value === undefined || value === '' ? undefined : value), description: 'The SMTP password, sent only to the SMTP server. Never logged.' }, MAIL_FROM: { schema: (value) => (value === undefined || value === '' ? undefined : value), description: 'The sender line on outgoing mail, for example `Fablewright `. Mail stays off until this is set.' } });