toolkitwire

package
v1.161.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package toolkitwire hands the platform's own dependencies to the toolkits that take them, by what each toolkit implements rather than by its kind: the metrics recorder to every toolkit that records its own (S3, the api gateway, postgres), and the platform's database to the postgres toolkits, whose every connection checks it did not reach that database (#2400).

It is a seam of pkg/platform, extracted when that package reached its size budget; the platform calls it with its registry's toolkits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDB

func AppDB(all func() []registry.Toolkit, authn middleware.Authenticator, authz middleware.Authorizer, adminPersona string,
	platformDB *sql.DB,
)

AppDB installs what script sessions run application-database statements with (#2428): the live postgres toolkit, read from all on every lookup so a toolkit the registry gains later is the one used, and the check that the run's persona may use the connection. With an authorizer that has no connection check (no personas configured) every connection is allowed, as every connection is to that deployment's tool calls.

adminPersona is the persona platform.maintain is allowed for on every connection (#2410).

platformDB answers which application's run role a script's statements log in as (#2539).

func AppDBReach added in v1.154.2

func AppDBReach(toolkits *registry.Registry, personas *persona.Registry, stored connview.StoreLister,
) func(ctx context.Context, actor application.Actor) ([]string, error)

AppDBReach is the application database connections an actor may hold an application's schema on (#2539): the appdb connections their persona reaches, every one for an administrator.

func Metrics

func Metrics(toolkits []registry.Toolkit, m *observability.Metrics)

Metrics pushes m into every toolkit that records its own metrics. Each toolkit's SetMetrics decides what it installs for a disabled recorder, and is idempotent against the same recorder.

func PostgresGuard

func PostgresGuard(toolkits []registry.Toolkit, platformDB *sql.DB, sealer *fieldcrypt.RestFieldEncryptor)

PostgresGuard installs, on every postgres toolkit, the check each new database connection passes: that it did not reach the platform's database (postgreskit.OwnDatabaseGuard), the store manage_schema keeps its migrations in (#2404), and the saved scripts a migration's rename is checked against (#2405), and what it asks about the applications holding its schemas (#2539). The platform runs it before any tool is registered, so no statement runs on a connection the check has not seen and the toolkit lists manage_schema when it registers. A deployment with no database has nothing to protect and no store, and installs nothing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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