deploy

package
v0.0.0-...-42d6f5d Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = DeployConfig{
	Workers:       10,
	InvalidateCDN: true,
	MaxDeletes:    256,
}

Functions

func InvalidateCloudFront

func InvalidateCloudFront(ctx context.Context, target *Target) error

InvalidateCloudFront invalidates the CloudFront cache for distributionID. Uses AWS credentials config from the bucket URL.

func InvalidateGoogleCloudCDN

func InvalidateGoogleCloudCDN(ctx context.Context, origin string) error

Invalidate all of the content in a Google Cloud CDN distribution.

Types

type DeployConfig

type DeployConfig struct {
	Targets  []*Target
	Matchers []*Matcher
	Order    []string

	// Usually set via flags.
	// Target deployment Name; defaults to the first one.
	Target string
	// Show a confirm prompt before deploying.
	Confirm bool
	// DryRun will try the deployment without any remote changes.
	DryRun bool
	// Force will re-upload all files.
	Force bool
	// Invalidate the CDN cache listed in the deployment target.
	InvalidateCDN bool
	// MaxDeletes is the maximum number of files to delete.
	MaxDeletes int
	// Number of concurrent workers to use when uploading files.
	Workers int
	// contains filtered or unexported fields
}

DeployConfig is the complete configuration for deployment.

func DecodeConfig

func DecodeConfig(cfg config.Provider) (DeployConfig, error)

DecodeConfig creates a config from a given Hugo configuration.

type Deployer

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

Deployer supports deploying the site to target cloud providers.

func New

func New(cfg config.AllProvider, logger loggers.Logger, localFs afero.Fs) (*Deployer, error)

New constructs a new *Deployer.

func (*Deployer) Deploy

func (d *Deployer) Deploy(ctx context.Context) error

Deploy deploys the site to a target.

type Matcher

type Matcher struct {
	// Pattern is the string pattern to match against paths.
	// Matching is done against paths converted to use / as the path separator.
	Pattern string

	// CacheControl specifies caching attributes to use when serving the blob.
	// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
	CacheControl string

	// ContentEncoding specifies the encoding used for the blob's content, if any.
	// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
	ContentEncoding string

	// ContentType specifies the MIME type of the blob being written.
	// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
	ContentType string

	// Gzip determines whether the file should be gzipped before upload.
	// If so, the ContentEncoding field will automatically be set to "gzip".
	Gzip bool

	// Force indicates that matching files should be re-uploaded. Useful when
	// other route-determined metadata (e.g., ContentType) has changed.
	Force bool
	// contains filtered or unexported fields
}

Matcher represents configuration to be applied to files whose paths match a specified pattern.

func (*Matcher) Matches

func (m *Matcher) Matches(path string) bool

type Target

type Target struct {
	Name string
	URL  string

	CloudFrontDistributionID string

	// GoogleCloudCDNOrigin specifies the Google Cloud project and CDN origin to
	// invalidate when deploying this target.  It is specified as <project>/<origin>.
	GoogleCloudCDNOrigin string

	// Optional patterns of files to include/exclude for this target.
	// Parsed using github.com/gobwas/glob.
	Include string
	Exclude string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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