Version: v0.7.2 Latest Latest

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 14 Imported by: 0



Package config provides TOML-based configuration for warp (.warprc.toml). Used to set up paths to tools, amongst other things.



View Source
const (
	Kustomize   = Tool("Kustomize")
	Helm        = Tool("Helm")
	KubeScore   = Tool("KubeScore")
	Kubectl     = Tool("Kubectl")
	Ksync       = Tool("Ksync")
	BrowserSync = Tool("BrowserSync")
	Docker      = Tool("Docker")

Names of the tools used by warp.


ToolNames gives all the required tools.


This section is empty.


type Config

type Config struct {
	// NameManagerURL is the URL for the name_manager backend.
	// name_manager is used to acquire/release stacks with no
	// race condition.
	// See
	NameManagerURL string

	// OutputRoot is the path to a folder, given relative to
	// the parent folder of the Config file, where all the
	// intermediary artifacts are put.  This folder is
	// within the workspace to allow for easy inspection
	// during debugging.
	OutputRoot string

	// Tools configures tools.  By default, the tools are looked up
	// in the PATH folders.
	Tools map[Tool]ToolInfo

	// Kubernetes holds the (default) configuration for the Kubernetes
	// cluster used for deployment.
	Kubernetes *Kubernetes

	// Telemetry configures telemetry.
	Telemetry Telemetry

	// WorkspaceDir is the workspace directory.
	WorkspaceDir string `toml:"-"`

	// RunID is a random ID specific to this run of "warp".
	RunID string `toml:"-"`
	// contains filtered or unexported fields

Config is the project-wide configuration for warp.

func Read

func Read(path string) (*Config, error)

Read reads the project-wide configuration.

func ReadFs

func ReadFs(fs afero.Fs, path string) (*Config, error)

ReadFs does the same as Read but on an arbitrary afero file system.

func (*Config) Logger

func (cfg *Config) Logger() *log.Logger

Logger gives the logger associated with this configuration.

func (*Config) Path

func (cfg *Config) Path(path string) string

Path resolves a path relative to the workspace dir.

func (*Config) ToolPath added in v0.0.3

func (cfg *Config) ToolPath(tool Tool) (fullPath string, err error)

ToolPath resolves the full path of a tool. It errors if the tool could not be found.

type Kubernetes

type Kubernetes struct {
	// DefaultContext is the default kubeconfig context to use.  If omitted,
	// the current kubeconfig context is used.
	DefaultContext string

	// Kubeconfig is a list of configuration files that are merged
	// to give the final kubeconfig configuration.  The files
	// are "~" (home) expanded.
	// For background info on configuration merging, see
	Kubeconfig []string

	// Resources is a list of custom resources to be managed by warp,
	// especially during garbage collection.
	Resources []Resource

	// PreservePVCByDefault should be set to true to enable preserving
	// persistent volume claims by default during garbage collection.
	PreservePVCByDefault bool

	// KubeconfigEnvVar is the value of the KUBECONFIG environment
	// variable that is created from Kubeconfig.
	KubeconfigEnvVar string `toml:"-"`

Kubernetes holds the configuration for a Kubernetes cluster used for deployment.

type Resource added in v0.1.0

type Resource struct {
	Group    string
	Version  string
	Resource string
	// Namespaced indicates whether the resource is namespaced or
	// cluster-wide.
	Namespaced bool

Resource identifies custom resources by group, version, and kind.

type Telemetry added in v0.1.0

type Telemetry struct {
	// Connection string for the telemetry module
	ConnectionString string

Telemetry configures telemetry. Telemetry is used to gather usage info.

type Tool

type Tool string

Tool is the name of a tool.

func (Tool) LogDomain

func (tool Tool) LogDomain() string

LogDomain gives the log domain for a tool.

type ToolInfo

type ToolInfo struct {
	// Path is the path to the tool on the local file system.
	Path string

ToolInfo configures a tool.

Jump to

Keyboard shortcuts

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