Database settings
If the recovery tools cannot be used (for example the API does not start), you can connect to the database directly. The settings are in the .env file in the SnailyCAD root folder. Never share these values.
| Parameter | Variable(s) | Example |
|---|---|---|
| Database name | DATABASE_URL / POSTGRES_DB | snaily-cad-v4 |
| Username | DATABASE_URL / POSTGRES_USER | postgres |
| Password | DATABASE_URL / POSTGRES_PASSWORD | <your password> |
| Host | DATABASE_URL / DB_HOST (POSTGRES_HOST in the recovery script) | localhost |
| Port | DATABASE_URL / DB_PORT (POSTGRES_PORT in the recovery script) | 5432 |
Prisma (the API) only reads DATABASE_URL. Its format is postgresql://USER:PASSWORD@HOST:PORT/DB_NAME?sslmode=prefer. In the default .env it is built from POSTGRES_USER, POSTGRES_PASSWORD, DB_HOST, DB_PORT and POSTGRES_DB, so if you change one of those, make sure DATABASE_URL still matches (or write the values directly into DATABASE_URL).
export PGPASSWORD=<your password> psql -U postgres -d snaily-cad-v4 -h localhost -p 5432
Locating, rotating and replacing the token
- Locate: on the API server, run cat apps/api/.recovery-token from the SnailyCAD folder. The exact absolute path is shown on the admin dashboard for the owner. Set RECOVERY_TOKEN_FILE in .env to use another location.
- Rotate: as the owner, open the admin dashboard and click "Rotate token". The new token is shown once and replaces the old one immediately.
- Replace: if you cannot log in, delete apps/api/.recovery-token and apps/api/.recovery-token.json and restart the API. A new token is generated, and you can read it from the file.
Full guide: sh/docs/RECOVERY.md