config

package
v0.0.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package config is the configuration structure and related functions.

Index

Constants

View Source
const Filename = "waypoint.hcl"

Filename is the default filename for the Waypoint configuration.

Variables

This section is empty.

Functions

func EvalContext

func EvalContext(pwd string) *hcl.EvalContext

EvalContext returns the common eval context to use for parsing all configurations. This should always be available for all config types.

The pwd param is the directory to use as a working directory for determining things like relative paths. This should be considered the pwd over the actual process pwd.

func FindPath

func FindPath(start, filename string) (string, error)

FindPath looks for our configuration file starting at "start" and traversing parent directories until it is found. If it is found, the path is returned. If it is not found, an empty string is returned. Error will be non-nil only if an error occurred.

If start is empty, start will be the current working directory. If filename is empty, it will default to the Filename constant.

func TestConfigFile

func TestConfigFile(t testing.T, src string)

TestConfigFile writes the default Waypoint configuration file with the given contents.

func TestSource

func TestSource(t testing.T) string

TestSource returns valid configuration.

func ValidateLabels

func ValidateLabels(labels map[string]string) []error

ValidateLabels validates a set of labels.

Types

type App

type App struct {
	Name   string            `hcl:",label"`
	Path   string            `hcl:"path,optional"`
	Labels map[string]string `hcl:"labels,optional"`
	URL    *AppURL           `hcl:"url,block" default:"{}"`

	Build   *Build   `hcl:"build,block"`
	Deploy  *Deploy  `hcl:"deploy,block"`
	Release *Release `hcl:"release,block"`
}

App represents a single application.

func (*App) Validate

func (app *App) Validate() error

type AppURL

type AppURL struct {
	AutoHostname *bool `hcl:"auto_hostname,optional"`
}

AppURL configures the App-specific URL settings.

type Build

type Build struct {
	Labels   map[string]string `hcl:"labels,optional"`
	Hooks    []*Hook           `hcl:"hook,block"`
	Use      *Use              `hcl:"use,block"`
	Registry *Registry         `hcl:"registry,block"`
}

Build are the build settings.

func (*Build) Operation

func (b *Build) Operation() *Operation

func (*Build) RegistryOperation

func (b *Build) RegistryOperation() *Operation

type CEBConfig

type CEBConfig struct {
	Addr          string `hcl:"addr,optional"`
	TLSEnabled    bool   `hcl:"tls_enabled,optional"`
	TLSSkipVerify bool   `hcl:"tls_skip_verify,optional"`
}

CEBConfig is specific configuration for the entrypoint binaries injected into the deployments

type Config

type Config struct {
	Runner  *Runner           `hcl:"runner,block" default:"{}"`
	Project string            `hcl:"project,attr"`
	Apps    []*App            `hcl:"app,block"`
	Labels  map[string]string `hcl:"labels,optional"`
	Plugin  []*Plugin         `hcl:"plugin,block"`
}

Config is the configuration structure.

func TestConfig

func TestConfig(t testing.T, src string) *Config

TestConfig returns a Config from a string source and fails the test if parsing the configuration fails.

func (*Config) AppConfig

func (c *Config) AppConfig(name string) (*App, bool)

Retrieve the app config for the named application

func (*Config) Default

func (c *Config) Default() error

Default sets the default values where values are unset on this config. This will modify the config in place.

func (*Config) Plugins

func (c *Config) Plugins() []*Plugin

Plugins returns all the plugins defined by this configuration. This will include the implicitly defined plugins via `use` statements.

func (*Config) Validate

func (c *Config) Validate() error

type DataSource

type DataSource struct {
	Type string   `hcl:",label"`
	Body hcl.Body `hcl:",remain"`
}

DataSource configures the data source for the runner.

type Deploy

type Deploy struct {
	Labels map[string]string `hcl:"labels,optional"`
	Hooks  []*Hook           `hcl:"hook,block"`
	Use    *Use              `hcl:"use,block"`
}

Deploy are the deploy settings.

func (*Deploy) Operation

func (b *Deploy) Operation() *Operation

type Hook

type Hook struct {
	When      string   `hcl:"when,attr"`
	Command   []string `hcl:"command,attr"`
	OnFailure string   `hcl:"on_failure,optional"`
}

Hook is the configuration for a hook that runs at specified times.

func (*Hook) ContinueOnFailure

func (h *Hook) ContinueOnFailure() bool

type Listener

type Listener struct {
	Addr        string `hcl:"address,attr"`
	TLSDisable  bool   `hcl:"tls_disable,optional"`
	TLSCertFile string `hcl:"tls_cert_file,optional"`
	TLSKeyFile  string `hcl:"tls_key_file,optional"`
}

type Operation

type Operation struct {
	Labels map[string]string `hcl:"labels,optional"`
	Hooks  []*Hook           `hcl:"hook,block"`
	Use    *Use              `hcl:"use,block"`
	// contains filtered or unexported fields
}

Operation is something in the Waypoint configuraiton that is executed using some underlying plugin. This is a general shared structure that is used by internal/core to initialize all the proper plugins.

type Plugin

type Plugin struct {
	// Name of the plugin. This is expected to match the plugin binary
	// "waypoint-plugin-<name>" including casing.
	Name string `hcl:",label"`

	// Type is the type of plugin this is. This can be multiple.
	Type struct {
		Mapper   bool `hcl:"mapper,optional"`
		Builder  bool `hcl:"build,optional"`
		Registry bool `hcl:"registry,optional"`
		Platform bool `hcl:"deploy,optional"`
		Releaser bool `hcl:"release,optional"`
	} `hcl:"type,block"`

	// Checksum is the SHA256 checksum to validate this plugin.
	Checksum string `hcl:"checksum,optional"`
}

Plugin configures a plugin.

func (*Plugin) Types

func (p *Plugin) Types() []component.Type

Types returns the list of types that this plugin implements.

type Registry

type Registry struct {
	Labels map[string]string `hcl:"labels,optional"`
	Hooks  []*Hook           `hcl:"hook,block"`
	Use    *Use              `hcl:"use,block"`
}

Registry are the registry settings.

func (*Registry) Operation

func (b *Registry) Operation() *Operation

type Release

type Release struct {
	Labels map[string]string `hcl:"labels,optional"`
	Hooks  []*Hook           `hcl:"hook,block"`
	Use    *Use              `hcl:"use,block"`
}

Release are the release settings.

func (*Release) Operation

func (b *Release) Operation() *Operation

type Runner

type Runner struct {
	// Enabled is whether or not runners are enabled. If this is false
	// then the "-remote" flag will not work.
	Enabled bool `hcl:"enabled,optional"`

	// DataSource is the default data source when a remote job is queued.
	DataSource *DataSource `hcl:"data_source,block"`
}

Runner is the configuration for supporting runners in this project.

type Server

type Server struct {
	Address string `hcl:"address,attr"`

	// Tls, if true, will connect to the server with TLS. If TlsSkipVerify
	// is true, the certificate presented by the server will not be validated.
	Tls           bool `hcl:"tls,optional"`
	TlsSkipVerify bool `hcl:"tls_skip_verify,optional"`

	// AddressInternal is a temporary config to work with local deployments
	// on platforms such as Docker for Mac. We need to discuss a more
	// long term approach to this.
	AddressInternal string `hcl:"address_internal,optional"`

	// Indicates that we need to present a token to connect to this server.
	RequireAuth bool `hcl:"require_auth,optional"`

	// AuthToken is the token to use to authenticate to the server.
	// Note this will be stored plaintext on disk. You can also use the
	// WAYPOINT_SERVER_TOKEN env var.
	AuthToken string `hcl:"auth_token,optional"`
}

Server configures the remote server.

type ServerConfig

type ServerConfig struct {
	// DBPath is the path to the database file, including the filename.
	DBPath string `hcl:"db_path,attr"`

	// GRPC is the grpc service listening configuration. This is required.
	GRPC Listener `hcl:"grpc,block"`

	// HTTP is the listening configuration for the HTTP service for grpc-web.
	HTTP Listener `hcl:"http,block"`

	// URL configures a server to use a URL service.
	URL *URL `hcl:"url,block"`

	// CEBConfig configures the entrypoint binary for deployments
	CEBConfig *CEBConfig `hcl:"entrypoint_config,block"`
}

ServerConfig is the configuration for the built-in server.

type URL

type URL struct {
	Enabled              bool   `hcl:"enabled,optional"`
	APIAddress           string `hcl:"api_address,optional"`
	APIInsecure          bool   `hcl:"api_insecure,optional"`
	APIToken             string `hcl:"api_token,optional"`
	ControlAddress       string `hcl:"control_address,optional"`
	AutomaticAppHostname bool   `hcl:"automatic_app_hostname,optional"`
}

URL is the configuration for the URL service.

type Use

type Use struct {
	Type string   `hcl:",label"`
	Body hcl.Body `hcl:",remain"`
}

Use is something in the Waypoint configuration that is executed using some underlying plugin. This is a general shared structure that is used by internal/core to initialize all the proper plugins.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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