mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
rename EVENT_INGEST_KEY -> PUBLISHABLE_KEY
The value is a pk- prefixed PUBLISHABLE key (the Stripe vocabulary, and what the build-time gate already tests for). EVENT_INGEST_KEY hid that. One substitution covers all three spellings, since the framework prefixes wrap the same token: EVENT_INGEST_KEY -> PUBLISHABLE_KEY, NEXT_PUBLIC_* and VITE_* follow. KMS already carries deploy/PUBLISHABLE_KEY (env prod) with the same value, written and read back first, so no build can reach a name that does not exist yet. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -141,7 +141,7 @@ Environment, read from `process.env` (Next), `import.meta.env` (Vite/Expo), or a
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `NEXT_PUBLIC_EVENT_INGEST_KEY` / `VITE_EVENT_INGEST_KEY` / `EXPO_PUBLIC_EVENT_INGEST_KEY` | — | Publishable `pk-…` key — **the one name**, the one KMS carries at `deploy/EVENT_INGEST_KEY` and the one `@hanzo/event` reads. Write-only and safe in a bundle. Without it a beacon is unattributed and the door refuses it. (The older `…_HANZO_INGEST_KEY` spelling is still read, second, and is being retired.) |
|
||||
| `NEXT_PUBLIC_PUBLISHABLE_KEY` / `VITE_PUBLISHABLE_KEY` / `EXPO_PUBLIC_PUBLISHABLE_KEY` | — | Publishable `pk-…` key — **the one name**, the one KMS carries at `deploy/PUBLISHABLE_KEY` and the one `@hanzo/event` reads. Write-only and safe in a bundle. Without it a beacon is unattributed and the door refuses it. (The older `…_HANZO_INGEST_KEY` spelling is still read, second, and is being retired.) |
|
||||
| `NEXT_PUBLIC_HANZO_API_URL` / `VITE_HANZO_API_URL` | `https://api.hanzo.ai` | The one front door. |
|
||||
| `NEXT_PUBLIC_HANZO_PRODUCT` / `VITE_HANZO_PRODUCT` | resolved from the runtime, then the hostname | Emitting surface. A Tauri window reports as `desktop` — it serves one bundle from three origins (`tauri://localhost`, `http://tauri.localhost`, the dev server), so the URL is the one thing that cannot name it. |
|
||||
| `NEXT_PUBLIC_HANZO_TELEMETRY` / `VITE_HANZO_TELEMETRY` | on | `0`/`false`/`off` is a build-time kill switch. |
|
||||
|
||||
@@ -61,15 +61,15 @@ function processEnv(): RawEnv {
|
||||
const e = process.env
|
||||
return {
|
||||
apiUrl: first(e.NEXT_PUBLIC_HANZO_API_URL, e.PUBLIC_HANZO_API_URL, e.HANZO_API_URL),
|
||||
// EVENT_INGEST_KEY is the name, and it is the one the fleet already
|
||||
// carries end to end: KMS holds `deploy/EVENT_INGEST_KEY`, each Dockerfile
|
||||
// PUBLISHABLE_KEY is the name, and it is the one the fleet already
|
||||
// carries end to end: KMS holds `deploy/PUBLISHABLE_KEY`, each Dockerfile
|
||||
// takes it as a build-arg, and @hanzo/event reads the same spelling. The
|
||||
// HANZO_INGEST_KEY family below is the older spelling still set by three
|
||||
// surfaces; it is read second and is being retired, not extended.
|
||||
ingestKey: first(
|
||||
e.NEXT_PUBLIC_EVENT_INGEST_KEY,
|
||||
e.PUBLIC_EVENT_INGEST_KEY,
|
||||
e.EVENT_INGEST_KEY,
|
||||
e.NEXT_PUBLIC_PUBLISHABLE_KEY,
|
||||
e.PUBLIC_PUBLISHABLE_KEY,
|
||||
e.PUBLISHABLE_KEY,
|
||||
e.NEXT_PUBLIC_HANZO_INGEST_KEY,
|
||||
e.PUBLIC_HANZO_INGEST_KEY,
|
||||
e.HANZO_INGEST_KEY
|
||||
@@ -108,9 +108,9 @@ function metaEnv(): RawEnv {
|
||||
e.PUBLIC_HANZO_API_URL
|
||||
),
|
||||
ingestKey: first(
|
||||
e.VITE_EVENT_INGEST_KEY,
|
||||
e.EXPO_PUBLIC_EVENT_INGEST_KEY,
|
||||
e.PUBLIC_EVENT_INGEST_KEY,
|
||||
e.VITE_PUBLISHABLE_KEY,
|
||||
e.EXPO_PUBLIC_PUBLISHABLE_KEY,
|
||||
e.PUBLIC_PUBLISHABLE_KEY,
|
||||
e.VITE_HANZO_INGEST_KEY,
|
||||
e.EXPO_PUBLIC_HANZO_INGEST_KEY,
|
||||
e.PUBLIC_HANZO_INGEST_KEY
|
||||
|
||||
@@ -49,12 +49,12 @@ describe('product', () => {
|
||||
})
|
||||
|
||||
describe('ingest key', () => {
|
||||
// EVENT_INGEST_KEY is the ONE name: KMS holds `deploy/EVENT_INGEST_KEY`, the
|
||||
// PUBLISHABLE_KEY is the ONE name: KMS holds `deploy/PUBLISHABLE_KEY`, the
|
||||
// Dockerfiles pass it through, and @hanzo/event reads the same spelling. A
|
||||
// surface that resolved no key sent unattributed beacons, which the door
|
||||
// refuses — silently, and invisibly until you read the warehouse.
|
||||
it('reads the canonical build-time name', () => {
|
||||
vi.stubEnv('NEXT_PUBLIC_EVENT_INGEST_KEY', 'pk_canonical')
|
||||
vi.stubEnv('NEXT_PUBLIC_PUBLISHABLE_KEY', 'pk_canonical')
|
||||
expect(describeTelemetry(createTelemetry())?.hasIngestKey).toBe(true)
|
||||
})
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('ingest key', () => {
|
||||
})
|
||||
|
||||
it('takes an explicit key over the environment', () => {
|
||||
vi.stubEnv('NEXT_PUBLIC_EVENT_INGEST_KEY', 'pk_env')
|
||||
vi.stubEnv('NEXT_PUBLIC_PUBLISHABLE_KEY', 'pk_env')
|
||||
const t = createTelemetry({ ingestKey: 'pk_explicit' })
|
||||
expect(describeTelemetry(t)?.hasIngestKey).toBe(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user