Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.99.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CachePath added in v0.79.0

func CachePath() (string, error)

func CheckCatalogDir

func CheckCatalogDir(catalogDir string) error

TODO: maybe this function belongs in package catalog?

func LoadFile

func LoadFile[T any](file string, value *T) error

func MergeCatalogResourceIntoCatalogConfig added in v0.92.0

func MergeCatalogResourceIntoCatalogConfig(catalogConfig *Catalog, catalogResource *v1alpha1.Catalog) 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 Catalog added in v0.49.1

type Catalog struct {
	// 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"`

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

	Helps map[string][]Help `yaml:"help,omitempty"`
}

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 {
	User
	Catalog

	JoyCache string
}

func FromContext

func FromContext(ctx context.Context) *Config

func Load

func Load(ctx context.Context, 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 (*Config) KnownChartRefs added in v0.39.0

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

func (Config) Validate added in v0.49.1

func (cfg Config) Validate() error

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 Help added in v0.49.0

type Help struct {
	// ErrorPattern is an optional regex pattern to match against the error message to determine if this help message should be displayed.
	ErrorPattern string `yaml:"error,omitempty"`

	// Message is the help message to display.
	Message string `yaml:"message,omitempty"`
}

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 User added in v0.49.1

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

	ColumnWidths ColumnWidths `yaml:"columnWidths,omitempty"`

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

func (User) Save added in v0.49.1

func (user User) Save() error

Save saves config back to its original file.

Jump to

Keyboard shortcuts

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