config

package
v0.0.1-test Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config implements loading the crossplane CLI config file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolvePath

func ResolvePath(flag string) string

ResolvePath returns the path to the config file, in priority order:

  1. flag - the value of the --config flag, if any.
  2. The CROSSPLANE_CONFIG environment variable.
  3. DefaultPath() (XDG/HOME-derived).

An empty string is returned only if no source produces one.

func Save

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

Save writes cfg as YAML to path. It creates parent directories with mode 0o755 and writes the file with mode 0o600. An empty path is an error.

Types

type Config

type Config struct {
	// Version is the version of the config file.
	Version int `json:"version"`

	Features Features `json:"features,omitzero"`
}

Config is the on-disk configuration for the crossplane CLI.

func Load

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

Load reads a Config from path. A missing file is not an error; the zero Config is returned. Unknown fields in the file are an error so typos in flag names surface immediately.

type Features

type Features struct {
	EnableAlpha bool `json:"enableAlpha,omitempty"`
	DisableBeta bool `json:"disableBeta,omitempty"`

	// GenerateGoModelAccessors enables generation of GetX/SetX accessor methods
	// on generated Go models. Disabled by default; opt in to use generics and
	// interfaces over generated resources.
	GenerateGoModelAccessors bool `json:"generateGoModelAccessors,omitempty"`

	// GenerateGoRuntimeObjects enables generation of runtime.Object methods and
	// per-package AddToScheme helpers on generated Go models. Disabled by
	// default; opt in to register generated types with a runtime.Scheme.
	GenerateGoRuntimeObjects bool `json:"generateGoRuntimeObjects,omitempty"`
}

Features configures feature visibility.

Jump to

Keyboard shortcuts

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