runtime

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 5 Imported by: 0

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

View Source
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.

View Source
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

func WorkspaceIDFromEnv() (*uuid.UUID, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL