secrets

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package secrets generates credentials and materializes references to them.

A materializer decides how a secret appears in a generated file: inline as its value, or as a ${VAR} reference that compose resolves from a .env file. Exporters for other platforms add their own materializers later.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ensure

func Ensure(m *model.Model, store *state.Secrets) (bool, error)

Ensure generates every secret the model's infra services need and does not have yet. It reports whether anything was added.

func EnvPrefixed

func EnvPrefixed(service, name string) string

EnvPrefixed prefixes an env variable with a service name, e.g. ANALYTICS_DATABASE_URL.

func Generate

func Generate(kind catalog.SecretKind) (string, error)

Generate returns a new random value of the given kind.

func VarName

func VarName(service, key string) string

VarName is the .env variable holding a service's secret, e.g. POSTGRES__SUPERUSER_PASSWORD. The double underscore separates the service from the key, so service "x-superuser" and service "x" never collide.

Types

type Materializer

type Materializer struct {
	// contains filtered or unexported fields
}

Materializer renders secret references for one mode and records which values a dotenv file must hold.

func NewMaterializer

func NewMaterializer(mode Mode, store *state.Secrets) *Materializer

NewMaterializer returns a materializer over store.

func (*Materializer) Dotenv

func (m *Materializer) Dotenv() []byte

Dotenv renders the .env file for every reference handed out, or nil in inline mode.

func (*Materializer) Ref

func (m *Materializer) Ref(service string) func(key string) string

Ref returns how service's secret key appears in a generated file.

type Mode

type Mode string

Mode selects a materializer.

const (
	// Inline writes secret values directly into the generated compose file.
	Inline Mode = "inline"
	// Dotenv writes secret values to a .env file the compose file references.
	Dotenv Mode = "dotenv"
)

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode validates a mode name; empty means Inline.

Jump to

Keyboard shortcuts

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