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):
- Auto-detected dotenv file at project root (`.env`)
- Files declared in `nextdeploy.yml` under `secrets.files[]` (in order)
- 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.
- 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 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 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 {
AppName string
Environment string
Region string
WorkerName string
ActiveVersion string
Status string // "Online", "Deploying", "Not Deployed", etc.
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.