Public Access
feat(dev): add the local profile with recorded third-party answers
Profile "local" points Steam, Twitch/IGDB and speedrun.com to a WireMock container from compose.yaml (recordings in local/wiremock) and checks logins against the local Auth. The IGDB lookups now keep only the ids they asked for: an answer with another game made tags and release years drop the whole batch.
This commit is contained in:
1 parent
5a089b2082
commit
5c0c0c6a78
54 files changed
+1539
-8
No files matched your search
@@ -264,7 +264,46 @@ a second row when IGDB learns its Steam appid later and the user owns it on Stea
|
||||
|
||||
## Run locally
|
||||
|
||||
Needs Java 25 and Docker.
|
||||
### Local development without keys (profile `local`)
|
||||
|
||||
The whole stack runs on your machine with no API keys and no calls to Steam, Twitch/IGDB or speedrun.com. Needs
|
||||
Java 25, Node 24 and Docker. Clone `ToBePlayed-Auth`, `ToBePlayed-Core` and `ToBePlayed-Frontend` next to each
|
||||
other, then start them in this order (Core also starts without Auth and finds it later):
|
||||
|
||||
1. **Auth**: in `ToBePlayed-Auth`, `./mvnw spring-boot:run -Dspring-boot.run.profiles=local`
|
||||
(IDE: active profile `local`). Port 8080.
|
||||
2. **Core**: in `ToBePlayed-Core`, `./mvnw spring-boot:run -Dspring-boot.run.profiles=local`. Port 8090.
|
||||
3. **Frontend**: in `ToBePlayed-Frontend`, `npm install`, then `npm run dev`, and open `http://localhost:5173`
|
||||
(`localhost`, not `127.0.0.1`, so the browser sends the login cookies to every local port). The development
|
||||
values must be `VITE_API_URL=http://localhost:8080` and `VITE_CORE_API_URL=http://localhost:8090`.
|
||||
4. **Log in** with `dev@localhost` / `password123`. On the dashboard, start a Steam sync: the library fills with 8
|
||||
games, achievements, time to beat, moods, a wishlist and one speedrun game from recorded answers.
|
||||
|
||||
What the `local` profile does:
|
||||
|
||||
- Spring Boot's Docker Compose support starts each service's `compose.yaml`: PostgreSQL for Auth (port 5432) and
|
||||
for Core (port 5433), and in Core a WireMock container (port 8089, compose profile `local`) that answers in
|
||||
place of Steam, Twitch/IGDB and speedrun.com from `ToBePlayed-Core/local/wiremock`.
|
||||
- Auth makes a new signing key at each start (`LocalKeysEnvironmentPostProcessor`, only in this profile), so no
|
||||
key is in the repo. After an Auth restart (also a devtools restart), log in again.
|
||||
- Never use `local` on a server: it adds an admin with a public password. Auth refuses `local` together with
|
||||
`prod`.
|
||||
- Auth adds the dev user (Flyway callback in `db/local`): role `PLATFORM_ADMIN`, so user, auditor and admin pages
|
||||
can all be tried ("View as" in the menu switches down), and a linked Steam ID that the recorded Steam answers
|
||||
belong to. The invite code for more users is `local`.
|
||||
- Core checks the login with Auth's local JWKS, like in production.
|
||||
- The browser still loads game pictures from the Steam and IGDB image servers; offline they stay gray.
|
||||
- "Sign in through Steam" still opens the real Steam page (no key needed). The dev user is already linked.
|
||||
- A request to WireMock that has no recording answers 404 and shows up in Core's log.
|
||||
|
||||
To change the recorded answers, edit the JSON in `local/wiremock/mappings` (which request) and
|
||||
`local/wiremock/__files` (the answer), then restart Core (it restarts the container). `LocalMocksParseTest` checks
|
||||
that every answer still fits the adapters' response types. `http://localhost:8089/__admin/requests` lists what Core
|
||||
asked.
|
||||
|
||||
### With the real services (profile `dev`)
|
||||
|
||||
Needs Java 25, Docker and your own keys.
|
||||
|
||||
```bash
|
||||
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
|
||||
|
||||
Reference in new issue
Block a user