add seed ability

This commit is contained in:
2026-08-01 16:15:55 -04:00
parent 2db105bd6f
commit 5e57c61e4b
7 changed files with 90 additions and 8 deletions
+17
View File
@@ -19,8 +19,25 @@ Open <http://127.0.0.1:3000>. The application creates `sustenance.db` in the wor
| `PUBLIC_BASE_URL` | derived from `BIND_ADDRESS` | Base URL used in invitation links |
| `COOKIE_SECURE` | `false` | Add the `Secure` attribute to session cookies |
| `REGISTRATION_MODE` | `invite_only` | Use `open` for local development; otherwise registration requires a valid list invitation after the first account |
| `SEED_CONFIG` | `seed.json` | Optional JSON file with a default user to create when the database is first initialized |
| `RUST_LOG` | `sustenance=debug,tower_http=info` | Log filter |
### Seeding a default user
If a JSON config file exists at the path given by `SEED_CONFIG` (default `seed.json`),
Sustenance creates the configured user on startup when the database has no users yet.
The file is optional — if it is missing or invalid, seeding is silently skipped.
```json
{
"user": {
"email": "you@example.com",
"display_name": "You",
"password": "a-strong-password"
}
}
```
## Current features
- Email/password accounts with Argon2 password hashes