mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
Two things wore the name "platform" here, and neither is the PaaS at
platform.hanzo.ai. That collision is why "where are my Bases?" had no answer a
person could act on: one prefix, two products, and the one you reached was
whichever you happened to mean.
A Base is what an org gets — its own collections, its own files, its own key —
so the resource a client addresses is /v1/bases. Not /v1/orgs: the org is IAM's
noun and Base does not get a second one. Everything scoped to an org now hangs
off the Base it belongs to (/v1/bases/{id}/config, /creds, /customers), and
compliance moves to /v1/compliance, a sibling of /v1/iam rather than a child of
Base's own resource. The package is `org`, which seven of its files already
were. Nothing addressed the old prefix — no client, no UI, no manifest — so this
renames a surface rather than breaking one.
The auth proxy is DELETED, not renamed. Its five routes reshaped bodies and
forwarded to /v1/iam/login, /signup, /userinfo and /send-verification-code —
which the opaque /v1/iam/{path...} passthrough beside it already reaches. So
Base carried a hand-written login, signup and one-time-code flow whose only job
was to be a second way to reach IAM. Auth is IAM's, and one way is the whole
point of that rule.
The prefix test that already banned /api/ bans this too, so the name cannot come
back: it reads route LITERALS through go/ast, so a comment explaining the ban is
prose and a route is a route. Verified to fail on the exact regression.
28 lines
980 B
Go
28 lines
980 B
Go
// Environment knobs for the platform-side KMS bridge.
|
|
|
|
package org
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// envOr reads an env var, falling back when unset or blank.
|
|
func envOr(key, fallback string) string {
|
|
if v := strings.TrimSpace(os.Getenv(key)); v != "" {
|
|
return v
|
|
}
|
|
return fallback
|
|
}
|
|
|
|
// nodeIDFromEnv reads $KMS_NODE_ID, defaulting to fallback. This is the ZAP
|
|
// transport label (mDNS / peer-table entry), NOT the auth identity — the auth
|
|
// identity is mnemonic-derived and lives under servicePathFromEnv.
|
|
func nodeIDFromEnv(fallback string) string { return envOr("KMS_NODE_ID", fallback) }
|
|
|
|
// servicePathFromEnv reads $KMS_SERVICE_PATH, defaulting to fallback. The
|
|
// mnemonic-derived identity is built under this path; same path across pods →
|
|
// same NodeID byte-for-byte. The kms-operator's consensus-authority snapshot
|
|
// enumerates the NodeIDs for every service path.
|
|
func servicePathFromEnv(fallback string) string { return envOr("KMS_SERVICE_PATH", fallback) }
|