app

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: AGPL-3.0 Imports: 56 Imported by: 0

Documentation

Overview

Package app owns Starport production composition and lifecycle.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigRequired reports an absent application configuration.
	ErrConfigRequired = errors.New("application config is required")
	// ErrStorageRequired reports a storage factory that returned no adapter.
	ErrStorageRequired = errors.New("storage factory returned no storage")

	// ErrBlobStorageRequired reports a file storage factory that returned no
	// store.
	ErrBlobStorageRequired = errors.New("file storage factory returned no store")
	// ErrCatalogRequired reports a catalog factory that returned no control plane.
	ErrCatalogRequired = errors.New("catalog factory returned no catalog")
	// ErrCredentialsRequired reports an absent provider-credential master key.
	ErrCredentialsRequired = errors.New("provider credential master key is required")
	// ErrAPIKeyRequired reports empty gateway API key storage.
	ErrAPIKeyRequired = errors.New("a gateway API key is required; run \"starport init\"")
	// ErrLocalTokenPathRequired reports a configuration with nowhere to keep this
	// machine's local admin token. The loader derives the path from the platform
	// paths, so an empty value means the configuration did not come from the
	// loader, and guessing a path here would put a credential somewhere the CLI
	// never looks.
	ErrLocalTokenPathRequired = errors.New("a local admin token path is required")
	// ErrLocalTokenExposed reports a gateway that would serve a never-rotated
	// local admin token on an address the network can reach.
	ErrLocalTokenExposed = errors.New("the local admin token has never been rotated")
	// ErrProviderCatalogChanged reports a credential result that was resolved
	// from a catalog generation that is no longer current.
	ErrProviderCatalogChanged = errors.New("provider catalog changed during reconciliation")
)

Functions

This section is empty.

Types

type App

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

App owns all constructed runtime dependencies.

func New

func New(cfg *config.Config, options ...Option) (*App, error)

New creates the complete production runtime without starting background work.

func (*App) CancelCatalogOperation added in v1.2.1

func (a *App) CancelCatalogOperation(
	_ context.Context,
	id string,
) (runtimecatalog.Operation, error)

CancelCatalogOperation ends one open catalog operation.

func (*App) CatalogChanges added in v1.1.0

func (a *App) CatalogChanges(ctx context.Context) (runtimecatalog.Diff, error)

CatalogChanges diffs the previous accepted generation against the current one.

func (*App) CatalogOperation added in v1.2.1

func (a *App) CatalogOperation(_ context.Context, id string) (runtimecatalog.Operation, error)

CatalogOperation reports one catalog operation by identifier.

func (*App) CatalogStatus added in v1.2.1

func (a *App) CatalogStatus(ctx context.Context) (runtimecatalog.AdminStatus, error)

CatalogStatus reports the operator view of the catalog runtime.

func (*App) CatalogSummary added in v1.2.1

func (a *App) CatalogSummary(ctx context.Context) (runtimecatalog.Summary, error)

CatalogSummary reports the allowlisted catalog view a reader receives. It is the admin status passed through the reader projection, so the two surfaces cannot drift: one status, one allowlist.

func (*App) Close

func (a *App) Close(ctx context.Context) error

Close stops owned dependencies in reverse construction order.

func (*App) ProviderIncidentLog added in v1.1.0

func (a *App) ProviderIncidentLog(ctx context.Context, providerID catalogs.ProviderID) (statuspage.History, bool)

ProviderIncidentLog answers one provider's published incident log. The second return reports whether the catalog knows the provider at all, so the HTTP surface can separate "unknown provider" from "no log".

func (*App) ProviderIncidentTransitions added in v1.1.0

func (a *App) ProviderIncidentTransitions(ctx context.Context, providerID catalogs.ProviderID) ([]providerstate.IncidentTransition, error)

ProviderIncidentTransitions answers the durable record of indicator changes this gateway observed for one provider, newest first.

func (*App) ProviderStates added in v1.0.3

func (a *App) ProviderStates() providerstate.Snapshot

ProviderStates returns one secret-free provider runtime projection.

The routing verdicts refresh here rather than at each publish. The registry replaces the runtime adapter set on its own schedule — when it opens, when a connector registers, and when it closes — so no publish site in this package observes every change to the routable snapshot. Deriving the verdicts against whichever snapshot the control plane currently holds binds the projection to the state the caller is about to read instead of to whichever publish happened to run last.

func (*App) RefreshProviders added in v1.0.3

func (a *App) RefreshProviders(ctx context.Context) (providers.ReconcileReport, error)

RefreshProviders forces one shared provider credential reconciliation. The HTTP admin route added by APR5 uses this application port.

func (*App) Run

func (a *App) Run(ctx context.Context) error

Run starts explicit runtime work and closes all dependencies on exit.

func (*App) StartCatalogRefresh added in v1.2.1

func (a *App) StartCatalogRefresh(context.Context) (runtimecatalog.Operation, bool, error)

StartCatalogRefresh accepts one catalog refresh and returns the operation that carries it. The second value reports that the request joined the run in flight rather than starting a second one.

The work outlives the request. An operator asked for the refresh, not for the response, so a client that disconnects does not end the run.

type Development added in v1.0.3

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

Development owns one isolated local application and its one-time key.

func NewDevelopment added in v1.0.3

func NewDevelopment(ctx context.Context, cfg *config.Config, options ...Option) (*Development, error)

NewDevelopment creates an in-memory gateway bound to loopback.

func (*Development) APIKey added in v1.0.3

func (runtime *Development) APIKey() string

APIKey returns the one-time ephemeral gateway credential.

func (*Development) Close added in v1.0.3

func (runtime *Development) Close(ctx context.Context) error

Close releases the development gateway and removes its scratch directory. The CLI calls it on every exit path, started or not.

func (*Development) ConsoleURL added in v1.1.0

func (runtime *Development) ConsoleURL() (string, error)

ConsoleURL returns a one-time link that signs one browser in to this development gateway.

The link is minted here rather than read from a file so it names this session's address and this session's port. A development gateway picks both at start, and a link that pointed at the configured gateway would sign the operator in to a different process than the one they just started.

func (*Development) Run added in v1.0.3

func (runtime *Development) Run(ctx context.Context) error

Run starts the development gateway and closes it on exit.

func (*Development) URL added in v1.0.3

func (runtime *Development) URL() string

URL returns the loopback gateway URL.

type Option

type Option func(*buildOptions)

Option changes runtime factories for explicit test composition.

func WithBuildInfo added in v1.2.0

func WithBuildInfo(version, commit, buildTime string) Option

WithBuildInfo states the version, commit, and build time the linker stamped into this binary, so the health and admin surfaces report the binary that answers. A runtime composed without it reports an unstamped build; the start time comes from the clock either way.

Jump to

Keyboard shortcuts

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