sharedenv

package
v0.0.0-...-d25dbbd Latest Latest
Warning

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

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

Documentation

Overview

Package sharedenv provides normalized shared environment read models and lookup services for config-domain consumers.

The package intentionally hides PocketBase record details from callers and exposes only normalized shared-env objects and lookup operations.

Index

Constants

View Source
const (
	SetCollection       = "env_sets"
	VarCollection       = "env_set_vars"
	AttachedSetsField   = "env_sets"
	SetRelationField    = "set"
	SecretRelationField = "secret"
)

Variables

This section is empty.

Functions

func AttachedSetIDs

func AttachedSetIDs(record *core.Record) []string

AttachedSetIDs returns the ordered, unique env set attachment ids stored on a consumer record.

Types

type AttachedVar

type AttachedVar struct {
	SetID   string
	SetName string
	Var     Var
}

AttachedVar preserves both the attached set identity and the normalized var. The returned order follows the consumer's env_sets attachment order.

func LoadAttachedVars

func LoadAttachedVars(app core.App, consumer *core.Record) ([]AttachedVar, error)

LoadAttachedVars expands the env set attachments from a consumer record into a flat variable list. Later attached sets appear later in the slice, so lifecycle consumers can apply "later set wins" semantics by iterating in order.

type Set

type Set struct {
	ID          string
	Name        string
	Description string
}

Set is the normalized read model for one shared env set.

func GetSet

func GetSet(app core.App, setID string) (*Set, error)

GetSet resolves one env set into a normalized read model.

func SetFromRecord

func SetFromRecord(record *core.Record) *Set

SetFromRecord normalizes an env_sets record.

type Var

type Var struct {
	ID       string
	SetID    string
	Key      string
	Value    string
	IsSecret bool
	SecretID string
}

Var is the normalized read model for one env_set_vars record.

func FindVar

func FindVar(app core.App, lookup VarLookup) (Var, error)

FindVar resolves one shared env variable under the expected env set.

func ListVars

func ListVars(app core.App, setID string) ([]Var, error)

ListVars returns normalized vars for one set.

func VarFromRecord

func VarFromRecord(record *core.Record) Var

VarFromRecord normalizes one env_set_vars record.

type VarLookup

type VarLookup struct {
	SetID     string
	VarID     string
	SourceKey string
}

VarLookup identifies one shared env variable inside a specific env set. Callers may provide VarID, SourceKey, or both. When both are provided they must resolve to the same variable.

Jump to

Keyboard shortcuts

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