config

package
v0.45.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CatalogConfigFile = "joy.yaml"
	JoyrcFile         = ".joyrc"
	JoyDefaultDir     = ".joy"
)
View Source
const (
	DefaultNarrowColumnWidth = 20
	DefaultNormalColumnWidth = 40
	DefaultWideColumnWidth   = 80
)

Variables

This section is empty.

Functions

func CheckCatalogDir

func CheckCatalogDir(catalogDir string) error

func ToContext

func ToContext(parent context.Context, cfg *Config) context.Context

func ToFlagsContext added in v0.33.1

func ToFlagsContext(parent context.Context, flags *GlobalFlags) context.Context

Types

type ColumnWidths added in v0.41.2

type ColumnWidths struct {
	Narrow int `yaml:"narrow,omitempty"`
	Normal int `yaml:"normal,omitempty"`
	Wide   int `yaml:"wide,omitempty"`
}

func (ColumnWidths) Get added in v0.41.2

func (c ColumnWidths) Get(narrow, wide bool) int

type Config

type Config struct {
	// CatalogDir is the directory containing catalog of environments, projects and releases.
	// Optional, defaults to ~/.joy
	CatalogDir string `yaml:"catalogDir,omitempty"`

	// Environments user has selected to work with.
	Environments Environments `yaml:"environments,omitempty"`

	// Releases user has selected to work with.
	Releases Releases `yaml:"releases,omitempty"`

	// MinVersion is the minimum version of the joy CLI required
	MinVersion string `yaml:"minVersion,omitempty"`

	// Charts are the known charts that environments and releases can reference
	Charts map[string]helm.Chart `yaml:"charts,omitempty"`

	// DefaultChartRef refers to the chart that must be used from Charts if a release doesn't specify any chart configuration
	DefaultChartRef string `yaml:"defaultChartRef,omitempty"`

	// ReferenceEnvironment is the name of the environment which represents master in git.
	// IE: if you deploy by default to an environment called "testing" when merging to your main remote branch
	// then referenceEnvironment should be "testing". This setting allows release versions to be compared to main version.
	ReferenceEnvironment string `yaml:"referenceEnvironment,omitempty"`

	// ValueMapping are used to apply parameters to the chart values. The values of the mapping
	// can use the Release and Environment as template values. Chart mappings will not override values
	// already present in the chart.
	// For example:
	//
	//   image.tag: {{ .Release.Spec.Version }}
	//   common.annotations.example\.com/custom: true
	//
	ValueMapping *ValueMapping `yaml:"valueMapping,omitempty"`

	// FilePath is the path to the config file that was loaded, used to write back to the same file.
	FilePath string `yaml:"-"`

	JoyCache string `yaml:"-"`

	RepositoriesDir string `yaml:"repositoriesDir,omitempty"`

	// Default GitHub organization to infer the repository from the project name.
	GitHubOrganization string `yaml:"gitHubOrganization,omitempty"`

	Templates Templates `yaml:"templates,omitempty"`

	ColumnWidths ColumnWidths `yaml:"columnWidths,omitempty"`
}

func FromContext

func FromContext(ctx context.Context) *Config

func Load

func Load(configDir, catalogDir string) (*Config, error)

Load loads config from given configDir (or user home if not specified) and optionally overrides loaded config's catalog directory with given catalogDir, defaulting to ~/.joy if not specified.

func LoadFile

func LoadFile(file string) (*Config, error)

func (*Config) KnownChartRefs added in v0.39.0

func (config *Config) KnownChartRefs() []string

func (*Config) Save

func (c *Config) Save() error

Save saves config back to its original file.

type EnvironmentTemplates added in v0.38.0

type EnvironmentTemplates struct {
	Links map[string]string `yaml:"links,omitempty"`
}

type Environments

type Environments struct {
	// Selected is the list of environments user has selected to work with.
	// Only those will be displayed in table columns by default.
	// An empty list means all environments are selected.
	Selected []string `yaml:"selected,omitempty"`
}

type GlobalFlags added in v0.33.1

type GlobalFlags struct {
	// SkipCatalogUpdate global flag used to skip catalog update and dirty check.
	SkipCatalogUpdate bool
}

func FlagsFromContext added in v0.33.1

func FlagsFromContext(ctx context.Context) *GlobalFlags

type ProjectTemplates added in v0.38.0

type ProjectTemplates struct {
	GitTag string            `yaml:"gitTag,omitempty"`
	Links  map[string]string `yaml:"links,omitempty"`
}

type ReleasePromoteTemplates added in v0.38.0

type ReleasePromoteTemplates struct {
	Commit      string `yaml:"commit,omitempty"`
	PullRequest string `yaml:"pullRequest,omitempty"`
}

type ReleaseTemplates added in v0.38.0

type ReleaseTemplates struct {
	Promote ReleasePromoteTemplates `yaml:"promote,omitempty"`
	Links   map[string]string       `yaml:"links,omitempty"`
}

type Releases

type Releases struct {
	// Selected is the list of releases user has selected to work with.
	// Only those will be displayed in table rows by default.
	// An empty list means all releases are selected.
	Selected []string `yaml:"selected,omitempty"`
}

type Templates added in v0.38.0

type Templates struct {
	Environment EnvironmentTemplates `yaml:"environment,omitempty"`
	Project     ProjectTemplates     `yaml:"project,omitempty"`
	Release     ReleaseTemplates     `yaml:"release,omitempty"`
}

type ValueMapping added in v0.27.2

type ValueMapping struct {
	ReleaseIgnoreList []string
	Mappings          map[string]any
}

func (*ValueMapping) UnmarshalYAML added in v0.27.2

func (mapping *ValueMapping) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML provides custom unmarshalling for backwards compatibility with map[string]string valueMappings. This is a stop gap so that we do not break the current joy CLI interpretation of the catalog. However, this will enable us to add a releaseIgnoreList to ignore injecting default values into charts that would otherwise break.

Jump to

Keyboard shortcuts

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