This repository has been archived on 2026-11-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Paul HittandClaude Opus 5 6f704cfb72 Take the donation here, on FlameNet's own account
Two things, and the second is why the first had to change.

The money was landing on the wrong account. `FN_DONATE_SECRET` is a Stripe
platform key, and a call that does not name a connected account is answered
against the platform itself — with a 200, a receipt and a charge, so
nothing about the page looks wrong and the only symptom is which balance it
turns up in. `FN_DONATE_ACCOUNT` is now sent as `Stripe-Account` when the
session is created, making the charge a direct one on FlameNet: its
balance, its fees, its payout, FLAMENET on the statement. Unset stays valid
and still means "charge whatever account this key belongs to", which is
what a self-hoster with their own key wants — and boot now says which of
the two it is doing, because the wrong one is otherwise silent.

Taking the payment on the page is the other half. The session is created
with `ui_mode=embedded_page` and mounted on `/donate`, so nobody is sent to
Stripe's site and returned. The card fields are still Stripe's own, in a
frame this server cannot read, which is what keeps this out of PCI scope —
`js.stripe.com` is the price of that and cannot be self-hosted.

⚠️ `ui_mode=embedded` — the documented value when this was written — is now
REJECTED: "The ui_mode value `embedded` is no longer supported. Use
`embedded_page` instead." Nothing pins a Stripe-Version, so the account's
default decides, and a rename on their side arrives as a 400 on a live
donate page rather than as a build failure here.

`Environment.value` comes with it, because the controller needs "blank
means absent": Compose sets every `VAR: ${VAR:-}` to the empty string and
`Environment.get` hands that back, so a plain `!= nil` reads an
unconfigured deployment as a configured one — which is how a page offers
payment with no processor behind it. The refusal is now specific: a missing
publishable key, a test secret paired with a live publishable key, or an
`FN_DONATE_ACCOUNT` that is not an account id each name themselves rather
than rendering a form that cannot work.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 14:55:53 -04:00

77 lines
3.2 KiB
Bash

# Copy to .env and fill in. Never commit .env.
#
# Generate each secret with:
# openssl rand -base64 36
# Postgres superuser/owner password. Used only by migrations.
POSTGRES_PASSWORD=
# Password for the per-tenant role the server actually connects as.
ENCLAVE_TENANT_PASSWORD=
# Signs and verifies clearance tokens. The account service signs with it, the
# file server verifies with it, and they must match. Minimum 32 chars.
# Rotating this invalidates every outstanding session.
ENCLAVE_JWT_SECRET=
# Derives product-scoped pseudonyms in the account service. Minimum 32 chars.
# Rotating this changes every pseudonym and orphans existing file data.
ENCLAVE_ACCOUNTS_SECRET=
# Password for the account service's own database role.
ENCLAVE_ACCOUNTS_DB_PASSWORD=
# Which account service the browser talks to.
#
# Self-hosting: leave this alone. `docker compose up` runs your own account
# service against your own database, and your users' accounts stay on your
# hardware. That is the point of self-hosting and it is the default.
#
# The flamenet.io deployment sets this to https://accounts.flamenet.io, the
# shared FlameNet account service, so one credential works across Messenger and
# Files. Pointing a self-hosted instance there would put your users' accounts on
# someone else's server — a real choice, but make it deliberately.
ENCLAVE_ACCOUNTS_URL=http://127.0.0.1:8100
# Where the *server* reaches the account service, which is not where the browser
# does. Leave it unset for the bundled compose — it already points the file
# server at the account container by name. It only matters if you split the two
# across hosts, and getting it wrong looks like "could not reach the account
# service" while the service is plainly running, because inside a container
# 127.0.0.1 is the container.
# ENCLAVE_ACCOUNTS_INTERNAL_URL=http://accounts:8100
# Tenant slug: lowercase letters, digits, underscore; 2-39 chars.
# Becomes schema "t_<slug>" and role "tenant_<slug>".
ENCLAVE_TENANT=default
# Bind address for the published port. Leave as 127.0.0.1 and put a TLS
# terminating reverse proxy in front; 0.0.0.0 exposes the app directly.
ENCLAVE_BIND=127.0.0.1
# Published host ports. Change these if something already holds 8080/8100.
ENCLAVE_PORT=8080
ENCLAVE_ACCOUNTS_PORT=8100
LOG_LEVEL=info
# Donations, via Stripe Checkout. The same variable names the Messenger relay
# reads, so one Stripe account can back both. Leave blank to hide the form.
#
# NEVER commit these. A payment credential in a public repository is cloned,
# cached and indexed long before it can be rotated.
FN_DONATE_PROVIDER=stripe
FN_DONATE_SECRET=
# The connected account donations are charged on, if the key above belongs to a
# Stripe platform rather than to the account meant to receive the money. Blank
# charges the key's own account, which is what a self-hoster wants.
FN_DONATE_ACCOUNT=
# Public by design, and handed to the browser: the embedded form cannot mount
# without it. With FN_DONATE_ACCOUNT set this is the PLATFORM's pk_, not the
# connected account's.
FN_DONATE_PUBLISHABLE_KEY=
# Where "read the code" points. Change it if you run a fork — sending your users
# to our repository to read code you have modified would be misleading.
ENCLAVE_SOURCE_URL=https://gitlab.com/paulhitt/flamenet-files