Files
heidi/.env.example

182 lines
9.3 KiB
Bash

# Secrets and settings this app reads at runtime. Copy to .env and fill in.
# Values live on the Hetzner box (/home/g/dev/<app>/.env), never in git.
DATABASE_URL=
# Models. The chat walks @bitbaum/ai-kit's free chain and uses every link it
# has a key for: GROQ_API_KEY first, then OPENROUTER_API_KEY. With neither, the
# chat says the language model is not set up on this deployment.
# GROQ_API_KEY is also the microphone: dictation in the chat and the
# transcript of a Standard German take on /speaking (lib/domain/model/speech.ts).
# Without it nothing is transcribed, and the pages say so.
# GEMINI_API_KEY is read-aloud from the server, for a device with no German
# voice of its own (lib/voice/server-tts.ts). Without it only the browser's
# voice is used.
GROQ_API_KEY=
OPENROUTER_API_KEY=
GEMINI_API_KEY=
# The model a pass buys (docs/payments.md). Off until all of these are set:
# HEIDI_PASS_MODELS names model ids at OpenRouter, in order, tried first for a
# pass holder and paid from OPENROUTER_API_KEY. AI_PAID_DISABLED=0 turns the
# fleet's kill switch off and HEIDI_AI_PAID_OK=1 opts Heidi in; both are
# @bitbaum/ai-kit's rules. HEIDI_DAILY_PAID_CALLS caps the paid calls of a day.
HEIDI_PASS_MODELS=
# The paid fallback (lib/domain/model/pass-model.ts): model ids at OpenRouter,
# asked for EVERYBODY when every free model is busy, before the weak routed
# one. Under the same switch, opt-in and daily caps as the pass model.
HEIDI_FALLBACK_MODELS=
AI_PAID_DISABLED=
HEIDI_AI_PAID_OK=
HEIDI_DAILY_PAID_CALLS=
# The grammar service for a transcribed take: a LanguageTool server of our
# own. Unset, @bitbaum/speechkit asks http://127.0.0.1:8010.
LANGUAGETOOL_URL=
NEXT_PUBLIC_FC_WIDGET_TOKEN=
# Channels (lib/channels). The hourly sweep (/api/cron/channels) runs only with
# CRON_SECRET; without it the channels page refreshes a person's own channels
# inline. Web Push needs a VAPID pair: `npx web-push generate-vapid-keys`.
# VAPID_SUBJECT is a mailto: or https: URL the push services may contact.
CRON_SECRET=
VAPID_PUBLIC_KEY=
VAPID_PRIVATE_KEY=
VAPID_SUBJECT=
# The fleet's chat-review loop. One shared secret, the same value in every
# product's env on the box (Loki's share-chat-review-token.yml writes it);
# Loki reads GET /api/chat/review-export with it each night. Unset, the
# export answers 503 and nothing is read.
CHAT_REVIEW_TOKEN=
# Accounts (@bitbaum/accountkit). BETTER_AUTH_SECRET signs sessions; without it
# (or without DATABASE_URL) the sign-in control is hidden. Generate once with
# `openssl rand -base64 48`.
BETTER_AUTH_SECRET=
# Account mail through @bitbaum/mail-kit: "Forgot your password?", the email
# sign-in link and the address check. Unset (or a placeholder key), the sign-in
# page offers none of them. RESEND_API_KEY is the fleet's shared Resend key.
# RESEND_FROM is optional and pins the From line. Unset, Heidi asks the mail
# service which domains this key has verified and sends from its own
# (heidi.orangecat.ch, then orangecat.ch) once one is; until then mail goes
# out through the fleet's shared sender domain (lib/auth/sender.ts).
# GET /api/health reports which is in use. A resend.dev sandbox sender counts
# as unconfigured in production.
# MAIL_ADDRESS is optional and sets Reply-To. Unset, replies go to the contact
# address in lib/config/site.ts, because Heidi's own host receives no mail.
RESEND_API_KEY=
RESEND_FROM=
MAIL_ADDRESS=
# Paying Heidi (docs/payments.md). The button on /pass that opens Heidi's
# public OrangeCat page needs none of these.
# ORANGECAT_PAY_ENTITY_ID is the OrangeCat entity that is paid and
# ORANGECAT_PAY_ENTITY_TYPE its kind; unset, they are Heidi's own project.
#
# The AUTOMATIC PASS through @bitbaum/paykit is OFF until HEIDI_SALES_ENABLED
# is on AND at least one price is set (whole sats; a pass with no price is not
# sold). Off, /pass says passes are not on sale, POST /api/pay/checkout answers
# 503 and no invoice is created, even with prices set. An invoice made while it
# was on still settles. Prices are decided by the owner; none is written in code.
# ORANGECAT_API_KEY is an ock_… integration key (scopes payments.write and
# payments.read), minted at https://orangecat.ch/settings/integrations.
# Optional: without it, and whenever the key's owner is the payee, paykit uses
# OrangeCat's account-less payment call.
# ORANGECAT_WEBHOOK_SECRET is the ock_whk_… secret OrangeCat shows once when
# the endpoint https://heidi.orangecat.ch/api/pay/webhook is registered there
# for the event payment.settled. Without it the checkout page's own poll
# still settles.
ORANGECAT_PAY_ENTITY_ID=
ORANGECAT_PAY_ENTITY_TYPE=
ORANGECAT_API_KEY=
ORANGECAT_WEBHOOK_SECRET=
HEIDI_SALES_ENABLED=
HEIDI_PASS_30_SATS=
HEIDI_PASS_365_SATS=
# Paying in francs: card, TWINT and whatever else the Stripe account has
# switched on (docs/payments.md). Off until the key and one CHF price are set.
# Prices in francs: 12 or 12.50. The webhook endpoint is
# /api/pay/webhook/stripe, events checkout.session.completed and
# checkout.session.async_payment_succeeded; without its secret a pass starts
# when the buyer is back on Heidi's checkout page.
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
HEIDI_PASS_30_CHF=
HEIDI_PASS_365_CHF=
# HEIDI PLUS, the subscription through the same Stripe account and webhook
# (lib/config/payments.ts, /owner/payments). Off until STRIPE_SECRET_KEY,
# STRIPE_WEBHOOK_SECRET and a monthly or yearly price are set; until then
# /plans shows Plus as «Bald verfügbar» with the notify form. Add the events
# invoice.paid, invoice.payment_failed and customer.subscription.created,
# .updated and .deleted to the webhook. Prices in francs; the owner decides.
# PROPOSAL, not applied: 12 a month, the first 3 months 6, 99 a year
# (31 % below twelve months).
HEIDI_PLUS_MONTH_CHF=
HEIDI_PLUS_YEAR_CHF=
HEIDI_PLUS_INTRO_CHF=
HEIDI_PLUS_INTRO_MONTHS=
# USAGE CAPS per signed-in person, counted on the server in Postgres, free and
# pass alike (docs/payments.md, lib/config/caps.ts). Required before any sale.
# Questions a day, chat and speaking judgements together (0 = no daily count):
# HEIDI_CAP_FREE_DAILY without a pass, default 100
# (old name, still read: HEIDI_FREE_TURNS_PER_DAY)
# HEIDI_CAP_PASS_DAILY with a pass, default 60. While the pass route is
# still the free chain set 300. Unset, but the old
# name set: that value times three.
# Per 30-day block of a pass (a 365-day pass gets the number in each block):
# HEIDI_CAP_PASS_VOICE_SECONDS seconds of NEW server voice, default 1200
# (cached lines are free; free users get the
# browser's voice only)
# HEIDI_CAP_PASS_DICTATION dictation clips, default 200
# HEIDI_CAP_FREE_DICTATION_DAILY dictation clips a day without a pass, default 10
# The pass route (the chat of pass holders). Unset, it is the free chain.
# HEIDI_PASS_MODELS (above) puts paid OpenRouter models first; these point the
# free vendors at a separate key or model list, e.g. a paid Groq key later:
# HEIDI_PASS_GROQ_API_KEY, HEIDI_PASS_GROQ_MODELS
HEIDI_CAP_FREE_DAILY=
HEIDI_CAP_PASS_DAILY=
HEIDI_CAP_PASS_VOICE_SECONDS=
HEIDI_CAP_PASS_DICTATION=
HEIDI_CAP_FREE_DICTATION_DAILY=
HEIDI_PASS_GROQ_API_KEY=
HEIDI_PASS_GROQ_MODELS=
HEIDI_FREE_TURNS_PER_DAY=
# The owner's numbers (GET /api/owner/numbers) and the owner's pass codes
# (/owner/pass-codes, docs/payments.md) answer 404 to everybody until
# one of these names the owner. OWNER_ACTOR_IDS is a comma-separated list of
# account ids; OWNER_EMAILS a list of addresses, which count only once the
# account's address is confirmed. See lib/domain/owner/gate.ts.
OWNER_ACTOR_IDS=
OWNER_EMAILS=
# Not read by the app. scripts/verify-dialect-asr.mjs, a one-off measurement
# of a dialect speech-to-text vendor, takes SPEECH_API_KEY (a live key),
# SPEECH_API_URL and SPEECH_DIALECT from the shell that runs it.
# Media (lib/media/variants.mjs). Photographs are served from object storage
# (Cloudflare R2, S3-compatible), in sizes rendered once, so the app box does
# no image work. The sources stay in public/photos.
#
# ON THE BOX, NOTHING IS RUN BY HAND. Give the bucket a public domain and put
# the four PHOTOS_S3_* settings and MEDIA_PUBLIC_BASE (that domain, without
# /photos) in /opt/fleet/env. Every deploy's `SELF_HOST=1 pnpm run build` then
# runs scripts/media/ensure.mjs first: it uploads the variants the bucket
# lacks (one at a time, low memory), fetches one through MEDIA_PUBLIC_BASE,
# and only on a 200 image writes NEXT_PUBLIC_MEDIA_BASE into the git-ignored
# .env.production.local, which turns the custom loader on. Anything missing
# or failing: one line in the build log, and the box serves the photos as
# before. The build never fails because of media.
#
# NEXT_PUBLIC_MEDIA_BASE set explicitly is an override: ensure.mjs leaves it
# alone and the site is built against it. By hand, from a laptop:
# node scripts/media/upload-photos.mjs # dry run
# node scripts/media/upload-photos.mjs --upload # idempotent
PHOTOS_S3_ENDPOINT=
PHOTOS_S3_BUCKET=
PHOTOS_S3_ACCESS_KEY_ID=
PHOTOS_S3_SECRET_ACCESS_KEY=
PHOTOS_S3_REGION=
MEDIA_PUBLIC_BASE=
NEXT_PUBLIC_MEDIA_BASE=
# The site address: first non-empty of SITE_URL, AUTH_URL, NEXT_PUBLIC_SITE_URL,
# else https://heidi.orangecat.ch. Changing it needs a redeploy (docs/site-address.md).
# SITE_URL=https://fragheidi.ch
# Further origins sign-in should trust, comma-separated, https only.
# SITE_EXTRA_ORIGINS=