config

package
v0.0.0-...-074a105 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Filename is the base name of the configuration file.
	Filename = "hfc.toml"
	// LocalFilename is the base name of the local configuration file, whose
	// values are deeply merged with the base configuration.
	LocalFilename = "hfc.local.toml"
)

Variables

This section is empty.

Functions

func FindPath

func FindPath() (string, error)

FindPath returns the rooted path to the configuration file in the current directory or its parents, or an error if it cannot find the file.

Types

type AWSConfig

type AWSConfig struct {
	Region string `toml:"region"`
}

AWSConfig represents the configuration for all AWS operations in this project.

type BuildConfig

type BuildConfig struct {
	Path string `toml:"path"`
}

BuildConfig represents the configuration for building a deployable Go binary.

type Config

type Config struct {
	Project  ProjectConfig  `toml:"project"`
	AWS      AWSConfig      `toml:"aws"`
	Build    BuildConfig    `toml:"build"`
	Upload   UploadConfig   `toml:"upload"`
	Template TemplateConfig `toml:"template"`
	Stacks   []StackConfig  `toml:"stacks"`
}

Config represents a full configuration.

func Load

func Load() (Config, error)

Load automatically loads the full configuration by finding, loading, and merging the base and local configurations.

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile loads configuration from a TOML file.

func Merge

func Merge(configs ...Config) Config

Merge deeply merges the provided configs, overriding the values in earlier configs with those in later configs.

func (*Config) FindStack

func (c *Config) FindStack(name string) (stack StackConfig, ok bool)

FindStack searches for the stack with the given name. If no stack is defined with the provided name, FindStack returns ok == false.

type ProjectConfig

type ProjectConfig struct {
	Name string `toml:"name"`
}

ProjectConfig represents the configuration for this project, which is expected to be common across all possible deployments.

type StackConfig

type StackConfig struct {
	Name       string            `toml:"name"`
	Parameters map[string]string `toml:"parameters"`
}

StackConfig represents the configuration of an AWS CloudFormation stack, a specific deployment of the CloudFormation template with a unique set of parameters.

type TemplateConfig

type TemplateConfig struct {
	Path         string   `toml:"path"`
	Capabilities []string `toml:"capabilities"`
}

TemplateConfig represents the configuration of the AWS CloudFormation template associated with the deployment.

type UploadConfig

type UploadConfig struct {
	Bucket string `toml:"bucket"`
	Prefix string `toml:"prefix"`
}

UploadConfig represents the configuration for uploading a Go binary in a Lambda .zip archive to an Amazon S3 bucket.

Jump to

Keyboard shortcuts

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