refinement phase 5
This commit is contained in:
@@ -75,9 +75,11 @@ Development environment, so this never affects a deployed build.
|
||||
dotnet run --project src/API/Baya.Web.Api/Baya.Web.Api.csproj
|
||||
```
|
||||
|
||||
On boot the API applies all EF migrations and seeds roles + an admin user + a sandbox payment gateway
|
||||
against the (empty) local DB, then listens on **`https://localhost:5002`** — Swagger at
|
||||
`https://localhost:5002/swagger`.
|
||||
On boot the API applies all EF migrations and seeds roles against the (empty) local DB, then listens on
|
||||
**`https://localhost:5002`** — Swagger at `https://localhost:5002/swagger`. In **Development** it also seeds a
|
||||
sandbox payment gateway and the demo world (below). It does **not** seed the old `admin`/`qw123321` account
|
||||
anymore (refinement-phase-5); a break-glass admin is created only if you set `Seed:AdminUsername` /
|
||||
`Seed:AdminPassword` (see below), and the day-to-day admin path is the phone-OTP demo admins.
|
||||
|
||||
In **Development** it additionally runs the **demo-world seeder** (Refinement Phase 1): verified/unverified
|
||||
demo nurses with priced variants + Tehran coverage (and therefore real `nurse_search_index` rows), plus demo
|
||||
@@ -112,7 +114,15 @@ endpoint works). Use them to see the real path populated:
|
||||
| `09120000011` | customer | رضا حسینی (male) | 1 patient, 1 Tehran address |
|
||||
| `09120000020` | admin (`super_admin`) | نگار مدیری (female) | full backoffice — **lands on `/admin`**, sees every console incl. RBAC |
|
||||
| `09120000021` | admin (`finance`) | کامران مالی (male) | scoped backoffice — lands on `/admin`, sidebar shows only the money consoles (`useAdminCapabilities` gating) |
|
||||
| `admin` / `qw123321` | admin | reference super-admin (username+password) | not a phone-OTP login — the frontend uses the phone admins above |
|
||||
|
||||
> The old username+password `admin`/`qw123321` account is **no longer auto-seeded** (refinement-phase-5 —
|
||||
> no committed credential). To bootstrap a break-glass username+password admin, set both secrets before boot,
|
||||
> then log in via the API (not the web UI, which is phone-OTP only):
|
||||
> ```bash
|
||||
> cd server/src/API/Baya.Web.Api
|
||||
> dotnet user-secrets set "Seed:AdminUsername" "admin"
|
||||
> dotnet user-secrets set "Seed:AdminPassword" "<a-strong-password>"
|
||||
> ```
|
||||
|
||||
The **phone-OTP admins** (`09120000020` / `09120000021`, refinement-phase-2) are how you reach the `/admin`
|
||||
console through the same web login flow as everyone else — admin sub-roles are server-granted, never
|
||||
@@ -148,8 +158,17 @@ Prove search works without the frontend: open Swagger →
|
||||
|
||||
## Good to know
|
||||
|
||||
- **The API speaks HTTP/2** (Kestrel `Protocols: Http2`, for gRPC). Browsers negotiate h2-over-TLS
|
||||
automatically, so `fetch` just works; for `curl` add `--http2`.
|
||||
- **The API speaks HTTP/1.1 and HTTP/2** (Kestrel `Protocols: Http1AndHttp2`, refinement-phase-5 — the
|
||||
previous HTTP/2-only default broke non-TLS HTTP/1.1 hops). Over TLS the client negotiates h2 via ALPN, so
|
||||
gRPC and `fetch` both work; plain-HTTP hops fall back to HTTP/1.1.
|
||||
- **Secrets fail fast.** On a fresh clone with no user-secrets the API refuses to start with
|
||||
`Refusing to start: required secret configuration is missing…` — set the connection-string user-secret
|
||||
(step 3) and boot again. Deployed environments must additionally supply real `IdentitySettings` JWE keys
|
||||
and `Seams:FieldEncryption` keys (Development uses dev-only defaults from `appsettings.Development.json`).
|
||||
- **Enable the secret-scan pre-commit hook** once per clone so a stray credential can't be committed:
|
||||
`git config core.hooksPath .githooks` (see [`.githooks/README.md`](../../../.githooks/README.md)).
|
||||
- **Behind a reverse proxy**, list its address in `ForwardedHeaders:KnownProxies` (or a CIDR in
|
||||
`:KnownNetworks`) so the rate limiter partitions on the real client IP, not the proxy's.
|
||||
- **Only `auth` is real by default.** 21 of 22 client service domains default to an in-browser mock
|
||||
(`USE_*_MOCK = true`); the home, search, bookings, etc. are fake in-memory data until Refinement Phase 4.
|
||||
- **The DB self-migrates + self-seeds**, so pointing at an empty local instance is enough — including the
|
||||
@@ -183,6 +202,7 @@ world, wipe the volume (`docker compose down -v`) and boot again.
|
||||
| Symptom | Fix |
|
||||
| --- | --- |
|
||||
| Browser: `net::ERR_CERT_AUTHORITY_INVALID` on `:5002` | Run `dotnet dev-certs https --trust` (setup step 1). |
|
||||
| API startup: `Refusing to start: required secret configuration is missing…` | The connection-string user-secret isn't set (or still the placeholder). Do setup step 3. |
|
||||
| API startup: `Login failed for user 'sa'` / connect timeout | DB not up or wrong password — check `docker compose ps` and that the user-secrets password matches `docker-compose.yml`. |
|
||||
| Console: `...has been blocked by CORS policy` | `UseCors` missing/mis-ordered, or the browser origin isn't in `Cors:AllowedOrigins`. It must sit after `UseRouting` and before the rate limiter. |
|
||||
| `dotnet user-secrets` errors with "could not find UserSecretsId" | Run it from `server/src/API/Baya.Web.Api` (the project with `<UserSecretsId>`). |
|
||||
|
||||
Reference in New Issue
Block a user