Scaffolds the server module and everything Phase 0 of PLAN.md calls for: a binary that boots, serves its discovery endpoints and nothing else yet. - config: one YAML file plus per-field WARP_* environment overrides, unknown fields rejected, validation that reports every problem at once - logging and metrics: slog, a Prometheus registry, per-route HTTP instrumentation labelled by pattern rather than path - httputil: the Matrix error envelope, error-returning handlers, CORS, request logging, panic recovery, and a router over http.ServeMux - endpoints: /_matrix/client/versions, /.well-known/matrix/client, /.well-known/matrix/server (gated), /healthz, /metrics, and M_UNRECOGNIZED for everything else - storage: driver registry, shared database/sql base, checksummed migration runner, sqlite and postgres drivers, pocketbase stub - settings: server_settings table behind a cached service, so the federation and registration switches change without a restart - federation: the gate that makes federation a runtime mode - cmd/warp: serve, migrate, generate-keys, version - Makefile, golangci-lint v2, GitHub Actions CI (Linux and Windows tests, race on Linux, storage tests against PostgreSQL, lint, boot smoke test), Dockerfile, example config and docs Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
95 lines
3.7 KiB
Plaintext
95 lines
3.7 KiB
Plaintext
# Warp homeserver configuration.
|
|
#
|
|
# Copy to warp.yaml and edit. Every field below is optional except
|
|
# global.server_name; the values shown are the defaults.
|
|
#
|
|
# Any field can also be set from the environment, which wins over this
|
|
# file. The variable name is on the right of each line below, e.g.
|
|
# WARP_SERVER_NAME=warp.example WARP_FEDERATION_ENABLED=true warp serve
|
|
# List values are comma-separated; a single "-" clears a list.
|
|
|
|
version: 1
|
|
|
|
global:
|
|
# The Matrix server name. It appears in every user, room and event ID
|
|
# and CANNOT be changed after the first event is written. WARP_SERVER_NAME
|
|
server_name: warp.example
|
|
|
|
# ed25519 signing key, created by `warp generate-keys`. WARP_PRIVATE_KEY
|
|
private_key: ./keys/signing.key
|
|
|
|
well_known:
|
|
# Advertised to clients as m.homeserver.base_url.
|
|
# Defaults to https://<server_name>. WARP_WELL_KNOWN_CLIENT_BASE_URL
|
|
client_base_url: ""
|
|
|
|
# Optional identity server. WARP_WELL_KNOWN_IDENTITY_SERVER_BASE_URL
|
|
identity_server_base_url: ""
|
|
|
|
# Advertised to other homeservers as m.server, e.g. "warp.example:8448".
|
|
# Only served while federation is enabled; empty means other servers
|
|
# fall back to SRV/A resolution. WARP_WELL_KNOWN_SERVER_ADDRESS
|
|
server_address: ""
|
|
|
|
listen:
|
|
address: ":8008" # WARP_LISTEN_ADDRESS
|
|
read_header_timeout: 10s # WARP_READ_HEADER_TIMEOUT
|
|
read_timeout: 60s # WARP_READ_TIMEOUT
|
|
write_timeout: 120s # WARP_WRITE_TIMEOUT
|
|
idle_timeout: 120s # WARP_IDLE_TIMEOUT
|
|
max_header_bytes: 1048576 # WARP_MAX_HEADER_BYTES
|
|
shutdown_timeout: 30s # WARP_SHUTDOWN_TIMEOUT
|
|
|
|
database:
|
|
# sqlite (dev, single user), postgres (production) or pocketbase
|
|
# (appliance; not implemented yet). WARP_DB_DRIVER
|
|
driver: sqlite
|
|
|
|
# sqlite: file:warp.db?_pragma=journal_mode(WAL)
|
|
# postgres: postgres://warp:secret@localhost/warp?sslmode=disable
|
|
# WARP_DB_CONNECTION_STRING
|
|
connection_string: "file:warp.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(10000)&_pragma=foreign_keys(1)"
|
|
|
|
max_open_conns: 10 # WARP_DB_MAX_OPEN_CONNS (ignored by sqlite:
|
|
max_idle_conns: 5 # WARP_DB_MAX_IDLE_CONNS one writer only)
|
|
conn_max_lifetime: 1h # WARP_DB_CONN_MAX_LIFETIME
|
|
|
|
# Apply pending migrations on startup. Set false to gate schema changes
|
|
# behind an explicit `warp migrate`. WARP_DB_AUTO_MIGRATE
|
|
auto_migrate: true
|
|
|
|
client_api:
|
|
# The Matrix spec expects a homeserver to allow any origin. Narrow this
|
|
# if only your own web client talks to it. WARP_CORS_ALLOWED_ORIGINS
|
|
cors_allowed_origins: ["*"]
|
|
|
|
federation:
|
|
# Off by default: a new install is a private homeserver until you say
|
|
# otherwise. WARP_FEDERATION_ENABLED
|
|
enabled: false
|
|
|
|
# Non-empty = federate ONLY with these servers.
|
|
# WARP_FEDERATION_ALLOWLIST
|
|
allowlist: []
|
|
|
|
# Always blocked, even if listed above. WARP_FEDERATION_DENYLIST
|
|
denylist: []
|
|
|
|
# Let the admin API flip `enabled` without a restart. When true, the
|
|
# stored setting overrides the value above on boot.
|
|
# WARP_FEDERATION_ALLOW_RUNTIME_TOGGLE
|
|
allow_runtime_toggle: true
|
|
|
|
registration:
|
|
enabled: false # WARP_REGISTRATION_ENABLED
|
|
allow_runtime_toggle: true # WARP_REGISTRATION_ALLOW_RUNTIME_TOGGLE
|
|
|
|
logging:
|
|
level: info # debug, info, warn, error WARP_LOG_LEVEL
|
|
format: text # text or json WARP_LOG_FORMAT
|
|
add_source: false # WARP_LOG_ADD_SOURCE
|
|
|
|
metrics:
|
|
enabled: true # WARP_METRICS_ENABLED
|
|
path: /metrics # WARP_METRICS_PATH
|