api

package
v0.39.9 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Overview

Package api provides the HTTP API server for kombify StackKits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolvedAccessProfile

type ResolvedAccessProfile struct {
	PrivateKey []byte
}

ResolvedAccessProfile is ephemeral internal SSH material.

type ResolvedBackupCredential

type ResolvedBackupCredential struct {
	AccessKeyID        string
	SecretAccessKey    string
	RepositoryPassword string
}

ResolvedBackupCredential is ephemeral internal backup repository material.

type ResolvedNodeOnboarding

type ResolvedNodeOnboarding struct {
	OnboardingKey string
}

ResolvedNodeOnboarding is ephemeral internal provider bootstrap material.

type ResponseMeta

type ResponseMeta struct {
	RequestID string `json:"request_id,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
}

ResponseMeta contains request tracking metadata.

type Server

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

Server is the StackKits HTTP API server.

func NewServer

func NewServer(cfg ServerConfig) *Server

NewServer creates a new API server.

func (*Server) Close

func (s *Server) Close()

Close stops background goroutines (e.g., rate limiter cleanup). Call this when the server is no longer needed to prevent goroutine leaks.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler with middleware applied.

type ServerConfig

type ServerConfig struct {
	OwnerStepUpOrigin                 string // Explicit HTTPS origin of this server for local PocketID approval callbacks.
	Port                              int
	BaseDir                           string
	Version                           string
	GitCommit                         string
	APIKey                            string   // If set, all non-health endpoints require X-API-Key header
	CORSOrigins                       []string // Allowed CORS origins; empty disables browser CORS, "*" allows wildcard
	RateLimit                         int      // Max requests per IP per minute; 0 = no limit
	LogDir                            string   // Directory containing deploy log files (.stackkit/logs/)
	ServiceAuthSecret                 string
	ServiceAuthSecretNext             string
	StackActionMode                   string
	StackActionRestoreVerifierCommand string
	SetupActionMode                   string
	SetupAdminEmail                   string
	SetupAdminPassword                string
	SetupImmichURL                    string
	SetupHomeAssistantURL             string
	SetupPocketIDURL                  string
	SetupVaultwardenURL               string
	SetupCloudreveURL                 string
	FilesSessionBridgeToken           string
	MCPToken                          string
	MCPAllowWrite                     bool
	// ArchitectureV2ResolveConcurrency limits concurrent governed CUE
	// resolutions per server. Values <= 0 use the fail-safe default.
	ArchitectureV2ResolveConcurrency int
	StackActionReferenceResolver     StackActionReferenceResolver
	// TrustedProxies may provide X-Forwarded-For for rate-limit identity.
	// Empty means X-Forwarded-For is ignored.
	TrustedProxies []string
}

ServerConfig holds configuration for the API server.

type StackActionReferenceResolver

type StackActionReferenceResolver interface {
	ResolveAccessProfile(context.Context, stackaction.ScopedReference) (ResolvedAccessProfile, error)
	ResolveNodeOnboarding(context.Context, stackaction.ScopedReference) (ResolvedNodeOnboarding, error)
	ResolveBackupCredential(context.Context, stackaction.ScopedReference) (ResolvedBackupCredential, error)
}

StackActionReferenceResolver is the internal custody boundary for resolving opaque StackAction references. Implementations must revalidate ref identity, version, scope, expiry, tenant/subject binding, grant state, and revocation against their authoritative store before returning short-lived material. Returned material must never be logged or persisted in action evidence.

Jump to

Keyboard shortcuts

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