storagelock

package
v1.801.415 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package storagelock refuses to boot the canonical Hanzo cloud orchestrator against Postgres.

The Go cloud binary (HIP-0106) is an orchestrator that mounts every Hanzo subsystem (iam, base, kms, commerce, ai, ...) into one process. It has no storage of its own — every subsystem owns its own per-(org, user) SQLite via hanzoai/base (HIP-0302).

Storage is per-(org, user) SQLite, always — there is no Postgres mode to fall back to. The lockdown makes that non-negotiable: if a manifest ever carries a Postgres pin (a `DATABASE_URL` / `driverName=postgres` knob), the binary refuses to boot rather than silently run on the wrong backend.

Index

Constants

This section is empty.

Variables

View Source
var ErrPostgresForbidden = errors.New("cloud: Postgres is not a supported storage backend (use per-tenant SQLite via hanzoai/base)")

ErrPostgresForbidden is returned when an env var pins cloud at PG.

Functions

func CheckEnv

func CheckEnv(lookup func(string) string) error

CheckEnv returns nil when the environment is clean, or a wrapped ErrPostgresForbidden enumerating every violation. cloud's main wires this and fails fast on any non-nil return.

func IsPostgres

func IsPostgres(v string) bool

IsPostgres reports whether the value parses as a Postgres DSN.

Types

type Violation

type Violation struct {
	Var   string
	Value string
}

Violation captures one offending (var, value) pair.

func Violations

func Violations(lookup func(string) string) []Violation

Violations enumerates every offending env var found in the supplied lookup function. The lookup is parameterised so tests can drive it without mutating os.Environ.

For driverName specifically, only "postgres" / "postgresql" values are violations; any other value (e.g. "sqlite") names the intended backend and is benign.

Jump to

Keyboard shortcuts

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