core

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 16 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 core defines the shared serverless provider contract, types, and local secret loading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadLocalSecrets

func LoadLocalSecrets(cfg *config.NextDeployConfig) (map[string]string, error)

LoadLocalSecrets merges secrets from every supported source for the current project. Precedence (lowest → highest):

  1. Auto-detected dotenv file at project root (`.env`)
  2. Files declared in `nextdeploy.yml` under `secrets.files[]` (in order)
  3. Doppler — when running under `doppler run -- nextdeploy ship`, or when `secrets.doppler.inject_env: true` is set in nextdeploy.yml, the process environment is harvested and merged. See harvestDopplerEnv.
  4. The managed JSON store at `.nextdeploy/.env`, populated by `nextdeploy secrets set/load`

Higher-precedence sources override lower ones. The managed store wins because it represents explicit user intent via the CLI.

func SecretsDeclared

func SecretsDeclared(cfg *config.NextDeployConfig) bool

SecretsDeclared reports whether the project references any secret source. When true, a LoadLocalSecrets failure must abort the deploy rather than ship an empty set — CF Worker uploads are replace-not-merge, so an empty set strips every live secret. When false (no declared sources) an empty set is legitimately the intended state.

Types

type BindingSummary added in v1.2.2

type BindingSummary struct {
	Type   string
	Name   string
	Target string
}

BindingSummary describes one declared Worker binding for reports and status.

type Provider

type Provider interface {
	// Initialize validates credentials and prepares the environment.
	Initialize(ctx context.Context, cfg *config.NextDeployConfig) error

	// DeployStatic uploads static assets (public/, .next/static/) to a CDN/Storage bucket.
	DeployStatic(ctx context.Context, pkg *packaging.PackageResult, cfg *config.NextDeployConfig, meta *nextcore.NextCorePayload) error

	// GetSecrets retrieves all secrets for the application.
	GetSecrets(ctx context.Context, appName string) (map[string]string, error)

	// SetSecret sets a single secret for the application.
	SetSecret(ctx context.Context, appName string, key, value string) error

	// UnsetSecret removes a single secret from the application.
	UnsetSecret(ctx context.Context, appName string, key string) error

	// UpdateSecrets securely injects/syncs a batch of secrets.
	UpdateSecrets(ctx context.Context, appName string, secrets map[string]string) error

	// DeployCompute packages the standalone build and updates the compute layer
	// (e.g., AWS Lambda + Web Adapter, Cloudflare Workers).
	DeployCompute(ctx context.Context, pkg *packaging.PackageResult, cfg *config.NextDeployConfig, meta *nextcore.NextCorePayload) error

	// InvalidateCache clears the CDN cache to ensure fresh assets are served.
	InvalidateCache(ctx context.Context, cfg *config.NextDeployConfig) error

	// Rollback reverts the compute layer to a previous version and
	// invalidates the CDN cache so the old version is served immediately.
	// Opts.Steps (default 1) walks N deployments back; Opts.ToCommit pins
	// rollback to a specific git commit (prefix match supported).
	Rollback(ctx context.Context, cfg *config.NextDeployConfig, opts RollbackOptions) error

	// Destroy removes all application resources from the cloud provider.
	Destroy(ctx context.Context, cfg *config.NextDeployConfig) error

	// GetResourceMap returns a summary of all provisioned cloud resources.
	GetResourceMap(ctx context.Context, cfg *config.NextDeployConfig) (ServerlessResourceMap, error)
}

Provider defines the interface for deploying to various serverless platforms (e.g., AWS, Cloudflare, GCP, Azure).

type ResourceSummary added in v1.2.2

type ResourceSummary struct {
	Kind string
	Name string
	ID   string
}

ResourceSummary describes one provisioned cloud resource for reports and status.

type RollbackOptions

type RollbackOptions struct {
	// Steps is the number of deployments to walk back from the current
	// active one (1 = previous deployment). Defaults to 1 when zero.
	Steps int
	// ToCommit is a git commit hash (full or short prefix) to roll back to.
	// Resolved against the deployment history; errors if not found within
	// the retention window.
	ToCommit string
}

RollbackOptions controls how a rollback selects its target deployment. Steps and ToCommit are mutually exclusive; ToCommit wins if both are set.

type ServerlessResourceMap

type ServerlessResourceMap struct {
	Provider             string // "cloudflare" | "aws"
	AppName              string
	Environment          string
	Region               string
	WorkerName           string
	WorkerURL            string // e.g. https://<worker>.<subdomain>.workers.dev
	ActiveVersion        string
	Status               string // "Online", "Deploying", "Not Deployed", etc.
	BundleSizeKB         int64
	BundleGzipKB         int64
	PlacementMode        string
	Bindings             []BindingSummary
	ProvisionedResources []ResourceSummary
	LambdaARN            string
	FunctionURL          string
	S3BucketName         string
	CloudFrontID         string
	CloudFrontDomain     string
	CustomDomain         string
	CertificateARN       string
	CertificateStatus    string // "PENDING_VALIDATION", "ISSUED", "FAILED"
	ValidationRecords    []dns.ValidationRecord
	DeploymentTime       time.Time
	DNSProvider          string // "namecheap", "cloudflare", "godaddy", "route53", "other"
}

ServerlessResourceMap holds the metadata for the visual report.

Jump to

Keyboard shortcuts

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