config

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JoyrcFile     = ".joyrc"
	JoyDefaultDir = ".joy"
)

Variables

This section is empty.

Functions

func CheckCatalogDir

func CheckCatalogDir(catalogDir string) error

func ToContext

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

Types

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"`

	// DefaultChart is the chart reference used by the catalog when omitted from the joy release
	DefaultChart string `yaml:"defaultChart,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"`

	// DefaultGitTagTemplate serves as the default gitTagTemplate for projects
	// Can be overriden in the project spec
	DefaultGitTagTemplate string `yaml:"defaultGitTagTemplate,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) Save

func (c *Config) Save() error

Save saves config back to its original file.

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 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 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

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