Help us shape the future of Go! Take the 2026 Go Developer Survey

app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 48 Imported by: 0

Documentation

Overview

Package app wires configuration, the stores and the HTTP server together. cmd/artifactweave stays a thin cobra shim and calls Run; tests drive Run with a fake handler.

Index

Constants

View Source
const InitialPasswordFile = "initial-admin-password"

InitialPasswordFile is where the first start writes a generated admin password, under the data directory. A file with mode 0600 rather than a log line, because logs are shipped and kept where the password must not be.

Variables

View Source
var ErrUnknownMigration = errors.New("unknown migrate action")

ErrUnknownMigration reports a migrate action other than up, down or version.

Functions

func ApplyDescriptor

func ApplyDescriptor(
	ctx context.Context,
	cfg config.Config,
	file string,
	dryRun bool,
	w io.Writer,
) error

ApplyDescriptor runs `artifactweave config apply`: it applies the descriptor in file to the store the configuration names, as `migrate` and `keys rotate` work on the store directly, and writes what changed to w. With dryRun it checks the whole descriptor against the current state and writes nothing.

It works on the store rather than calling a running server so that it needs no admin credentials in the CI job, only the configuration the server itself uses, and so that it can prepare a store before the first start. It runs the same code as PATCH /api/system/configuration.

func Keyring

func Keyring(cfg config.Config) (*crypt.Keyring, error)

Keyring builds the keyring from master_key and, during a rotation, master_key_previous (crypt.ParseVersionedKey). It returns nil without error when no master key is configured, for the commands that run without one.

func Migrate

func Migrate(ctx context.Context, cfg config.Config, action string, to int, w io.Writer) error

Migrate runs `artifactweave migrate <action>`: "up" applies every pending migration, "down" reverts those newer than to (one step when to is negative, everything when it is 0), and "version" reports the applied and latest versions. It writes one line of outcome to w.

func OpenStore

func OpenStore(
	ctx context.Context,
	cfg config.Config,
	o sqlcommon.Options,
) (*sqlcommon.Store, error)

OpenStore opens the configured metadata store. The SQLite file's directory is created when missing, so a first start needs nothing but a data directory path.

func RotateKeys

func RotateKeys(ctx context.Context, cfg config.Config, w io.Writer) error

RotateKeys runs `artifactweave keys rotate`: it opens the store with the configured keyring (master_key and master_key_previous), re-seals every sealed value under the newest version and reports how many changed. Once it has run, master_key_previous can be removed.

func Run

func Run(ctx context.Context, cfg config.Config, log *slog.Logger) error

Run opens the store and blob stores, serves until ctx is cancelled, then drains and closes them and returns nil. Any startup, listener or serve failure is returned wrapped.

Types

This section is empty.

Jump to

Keyboard shortcuts

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