Files
Mateusz PstruchaandClaude Opus 5.5 0f497d88de
CI / test (push) Successful in 3m56s
Deploy tern-server on its own; accept hex keys; fix cross-origin auth
The integrated stack is gone: deploy/compose.yml is just the server and
its Postgres, published on 11901 behind the existing nginx as
tern-api.mtps.pl, and this repo's release deploys it after pushing the
image. The webapp deploys separately from tern-web.

CREDENTIAL_KEY may now be 64 hex digits as well as base64, and a wrong
length says how to generate a right one. The database password reaches
the server as PGPASSWORD rather than inside DATABASE_URL, so it needs
no URL-escaping.

CORS now names Authorization and Content-Type instead of `*`: browsers
don't let the wildcard cover Authorization, so every signed-in request
from the webapp's own origin would have been refused. A route test
checks the preflight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:44:22 +02:00

38 lines
1.6 KiB
Bash

# Copy to .env for local development (docker-compose reads this automatically
# for the `db` service password; the app reads it via dotenvy at startup).
DATABASE_URL=postgres://tern:tern@localhost:5432/tern
BIND_ADDR=127.0.0.1:8080
# 32 random bytes, as 64 hex digits (openssl rand -hex 32) or base64
# (openssl rand -base64 32). Encrypts stored IMAP/SMTP credentials at rest
# (see src/crypto.rs). Losing this key makes every stored account credential
# unrecoverable — back it up outside the database.
CREDENTIAL_KEY=
BLOB_STORAGE_DIR=./data/blobs
# Sessions last this long since they were last *used* — a client in regular
# use stays signed in; one left alone for this long has to sign in again.
SESSION_TTL_HOURS=720
# Anyone may create a user. Off by default: then only the first user can
# register, which is how a new server gets its owner.
#OPEN_REGISTRATION=true
# Days mail stays in Trash before it's permanently deleted. 0 disables purging.
TRASH_RETENTION_DAYS=30
# --- UnifiedPush (Android notifications) ---
# Endpoints come from the phone's distributor (e.g. the ntfy app), so they
# carry the push server's *public* URL. If this server should reach it some
# other way, rewrite the prefix: comma-separated from=>to pairs.
#PUSH_URL_REWRITE=https://ntfy.example.org/=>http://ntfy:80/
# Trust an extra CA (PEM) for the push server, e.g. an internal CA...
#PUSH_CA_CERT=/etc/tern/push-ca.pem
# ...or, last resort, skip certificate checks for push requests entirely.
#PUSH_TLS_INSECURE=true
# Contact for push-service operators, sent in VAPID-signed requests.
#PUSH_VAPID_SUBJECT=mailto:you@example.org
RUST_LOG=tern_server=debug,tower_http=debug