spare

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFilePath string = ".spare.yml"

ConfigFilePath is the path of the configuration file.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SpareTemplateVersion TemplateVersion `yaml:"spareTemplateVersion"`
	// DeployTarget is the path of the deploy target (it's SPA).
	DeployTarget DeployTarget `yaml:"deployTarget"`
	// Region is AWS region.
	Region model.Region `yaml:"region"`
	// CustomDomain is the domain name of the CloudFront.
	// If you do not specify this, the CloudFront default domain name is used.
	CustomDomain model.Domain `yaml:"customDomain"`
	// S3Bucket is the name of the S3 bucket.
	S3Bucket model.Bucket `yaml:"s3BucketName"` //nolint
	// AllowOrigins is the list of domains that are allowed to access the SPA.
	AllowOrigins            model.AllowOrigins `yaml:"allowOrigins"`
	DebugLocalstackEndpoint model.Endpoint     `yaml:"debugLocalstackEndpoint"`
}

Config is a struct that corresponds to the configuration file ".spare.yml".

func NewConfig

func NewConfig() *Config

NewConfig returns a new Config.

func (*Config) DefaultS3BucketName

func (c *Config) DefaultS3BucketName() model.Bucket

DefaultS3BucketName returns the default S3 bucket name.

func (*Config) Read

func (c *Config) Read(r io.Reader) (err error)

Read reads the Config from the io.Reader.

func (*Config) Validate

func (c *Config) Validate(debugMode bool) error

Validate validates the Config. If debugMode is true, it validates the DebugLocalstackEndpoint.

func (*Config) Write

func (c *Config) Write(w io.Writer) (err error)

Write writes the Config to the io.Writer.

type DeployTarget

type DeployTarget string

DeployTarget is a type that represents a deploy target path.

func (DeployTarget) String

func (d DeployTarget) String() string

String returns the string representation of DeployTarget.

func (DeployTarget) Validate

func (d DeployTarget) Validate() error

Validate validates DeployTarget. If DeployTarget is invalid, it returns an error. DeployTarget is invalid if it is empty.

type TemplateVersion

type TemplateVersion string

TemplateVersion is a type that represents a spare template version.

const CurrentSpareTemplateVersion TemplateVersion = "0.0.1"

CurrentSpareTemplateVersion is the version of the template.

func (TemplateVersion) String

func (t TemplateVersion) String() string

String returns the string representation of TemplateVersion.

func (TemplateVersion) Validate

func (t TemplateVersion) Validate() error

Validate validates TemplateVersion. If TemplateVersion is invalid, it returns an error. TemplateVersion is invalid if it is empty.

Jump to

Keyboard shortcuts

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