Documentation
¶
Overview ¶
Package runtime exposes process-wide configuration read at startup time: most importantly the optional workspace context that scopes every domain Store. WORKSPACE_ID env unset → legacy mode (no filter, NULL inserts); set → all reads filtered by that UUID and all writes populate it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidWorkspaceID = errors.New("WORKSPACE_ID env is not a valid UUID")
ErrInvalidWorkspaceID is returned by WorkspaceIDFromEnv when the env var is set but cannot be parsed as a UUID. Callers typically log.Fatal on this.
var ErrSentinelWorkspaceID = errors.New(
"WORKSPACE_ID equals migration 000015 sentinel — " +
"substitute the real UUID before starting the server",
)
ErrSentinelWorkspaceID is returned when WORKSPACE_ID is set to the migration 000015 sentinel UUID — using this in production would expose every row backfilled by an unsubstituted migration as if it belonged to one workspace. Callers MUST log.Fatal on this so the server refuses to start.
Functions ¶
func WorkspaceIDFromEnv ¶
WorkspaceIDFromEnv returns the optional workspace ID configured via the WORKSPACE_ID environment variable.
Returns (nil, nil) when the env is unset → all stores operate in legacy mode: no WHERE filter on workspace_id, INSERT with NULL workspace_id.
Returns (id, nil) when set and well-formed → stores filter and populate.
Returns (nil, err wrapping ErrInvalidWorkspaceID) when set but malformed.
Types ¶
This section is empty.