Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootstrapPlatformAdmin ¶ added in v0.8.0
func BootstrapPlatformAdmin(ctx context.Context, pool *pgxpool.Pool, email string, log *slog.Logger) error
BootstrapPlatformAdmin covers the zero-to-one platform-admin bootstrap: when no platform admin exists yet, it promotes the user identified by email (case-insensitive). The caller (product main.go) reads the env var and passes the address in — the framework function never touches the environment.
Semantics (deliberately narrow):
- empty/blank email → info-skip (feature off);
- any platform admin already exists → info-skip (only ever 0→1: a post-compromise env flip cannot mint a second admin, and nothing here ever demotes);
- email not registered yet → warn-skip, not an error (deploy-before- register is a legal order; the next boot retries);
- no audit record: no principal exists at boot, the startup log is the trail. Ongoing grants/revokes keep going through PATCH /api/admin/users/{id}/admin.
Idempotent on every boot; call once after migrations have run.
Types ¶
Click to show internal directories.
Click to hide internal directories.