chore(db): rename SQLite database file to notify.sqlite
Use a generic database filename for future notification-related storage, and update docs and env comments to match.
This commit is contained in:
@@ -9,7 +9,7 @@ PORT=3003
|
||||
# FIREBASE_SERVICE_ACCOUNT_JSON={"type":"service_account",...}
|
||||
|
||||
# Directory for the SQLite FCM registration database (default: ./data).
|
||||
# Creates fcm-tokens.sqlite (plus -wal/-shm while the process is running).
|
||||
# Creates notify.sqlite (plus -wal/-shm while the process is running).
|
||||
# FCM_TOKEN_DATA_DIR=./data
|
||||
|
||||
# Set to "test-local" to bypass ethr JWT expiry verification in local dev only.
|
||||
|
||||
14
README.md
14
README.md
@@ -22,7 +22,7 @@ pnpm run dev
|
||||
|
||||
The server starts on `http://localhost:3003` (or the port in `PORT`). Hot-reloads on file changes.
|
||||
|
||||
On first use, the service creates `FCM_TOKEN_DATA_DIR` (default `./data`) and the SQLite file `fcm-tokens.sqlite` with the required schema.
|
||||
On first use, the service creates `FCM_TOKEN_DATA_DIR` (default `./data`) and the SQLite file `notify.sqlite` with the required schema.
|
||||
|
||||
### Authentication
|
||||
|
||||
@@ -38,9 +38,9 @@ Set `NODE_ENV=test-local` in `.env` to bypass ethr JWT *expiry* verification dur
|
||||
|
||||
| Path | Description |
|
||||
|---|---|
|
||||
| `{FCM_TOKEN_DATA_DIR}/fcm-tokens.sqlite` | Primary SQLite database (default dir: `./data`) |
|
||||
| `{FCM_TOKEN_DATA_DIR}/fcm-tokens.sqlite-wal` | WAL journal (present while the process is running) |
|
||||
| `{FCM_TOKEN_DATA_DIR}/fcm-tokens.sqlite-shm` | Shared-memory file used with WAL mode |
|
||||
| `{FCM_TOKEN_DATA_DIR}/notify.sqlite` | Primary SQLite database (default dir: `./data`) |
|
||||
| `{FCM_TOKEN_DATA_DIR}/notify.sqlite-wal` | WAL journal (present while the process is running) |
|
||||
| `{FCM_TOKEN_DATA_DIR}/notify.sqlite-shm` | Shared-memory file used with WAL mode |
|
||||
|
||||
`FCM_TOKEN_DATA_DIR` defaults to `./data` (relative to the process working directory). The `data/` directory is gitignored.
|
||||
|
||||
@@ -64,8 +64,8 @@ There is **no automatic migration** from the old JSON file (`fcm-tokens.json`).
|
||||
|
||||
Persist or back up the SQLite files under `FCM_TOKEN_DATA_DIR`:
|
||||
|
||||
1. Prefer stopping the service, then copy `fcm-tokens.sqlite` (and any `-wal` / `-shm` sidecars if present).
|
||||
2. Or, while the service is running, copy **all three** files (`fcm-tokens.sqlite`, `-wal`, `-shm`) together so the backup stays consistent under WAL mode.
|
||||
1. Prefer stopping the service, then copy `notify.sqlite` (and any `-wal` / `-shm` sidecars if present).
|
||||
2. Or, while the service is running, copy **all three** files (`notify.sqlite`, `-wal`, `-shm`) together so the backup stays consistent under WAL mode.
|
||||
3. For Docker, mount a volume at the data directory (or set `FCM_TOKEN_DATA_DIR` to a mounted path) so registrations survive container recreation.
|
||||
|
||||
## Production
|
||||
@@ -97,4 +97,4 @@ Required environment variables:
|
||||
| `FIREBASE_SERVICE_ACCOUNT_JSON` | Inline service account JSON (one line). If unset, falls back to Application Default Credentials. |
|
||||
| `PORT` | HTTP port (default: `3003`). |
|
||||
| `ENDORSER_URL` | Endorser API base URL used for auth checks on register/refresh (default: `https://api.endorser.ch`). |
|
||||
| `FCM_TOKEN_DATA_DIR` | Directory for the SQLite database file `fcm-tokens.sqlite` (default: `./data`). |
|
||||
| `FCM_TOKEN_DATA_DIR` | Directory for the SQLite database file `notify.sqlite` (default: `./data`). |
|
||||
|
||||
@@ -4,7 +4,7 @@ import Database from "better-sqlite3";
|
||||
|
||||
const dataDir =
|
||||
process.env.FCM_TOKEN_DATA_DIR ?? path.join(process.cwd(), "data");
|
||||
const dbFile = path.join(dataDir, "fcm-tokens.sqlite");
|
||||
const dbFile = path.join(dataDir, "notify.sqlite");
|
||||
|
||||
const SCHEMA_SQL = `
|
||||
CREATE TABLE IF NOT EXISTS fcm_registrations (
|
||||
|
||||
Reference in New Issue
Block a user