config

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Filename into which Config is serialized
	Filename = "config.yaml"

	// Repositories is the default directory for repositoires.
	Repositories = "repositories"

	// DefaultLanguage is intentionaly undefined.
	DefaultLanguage = ""

	// DefaultBuilder is statically defined by the builders package.
	DefaultBuilder = builders.Default
)

Variables

This section is empty.

Functions

func CreatePaths added in v0.36.0

func CreatePaths() (err error)

CreatePaths is a convenience function for creating the on-disk func config structure. All operations should be tolerant of nonexistant disk footprint where possible (for example listing repositories should not require an extant path, but _adding_ a repository does require that the func config structure exist. Current structure is: ~/.config/func ~/.config/func/repositories

func DefaultNamespace added in v0.36.0

func DefaultNamespace() (namespace string)

DefaultNamespace for remote operations is the currently active context namespace (if available) or the fallback "default".

func Dir added in v0.36.0

func Dir() (path string)

Dir is derived in the following order, from lowest to highest precedence.

  1. The default path is the zero value, indicating "no config path available", and users of this package should act accordingly.
  2. ~/.config/func if it exists (can be expanded: user has a home dir)
  3. The value of $XDG_CONFIG_PATH/func if the environment variable exists.

The path is created if it does not already exist.

func File added in v0.36.0

func File() string

File returns the full path at which to look for a config file. Use FUNC_CONFIG_FILE to override default.

func RepositoriesPath added in v0.36.0

func RepositoriesPath() string

RepositoriesPath returns the full path at which to look for repositories. Use FUNC_REPOSITORIES_PATH to override default.

Types

type Global added in v0.36.0

type Global struct {
	Builder   string `yaml:"builder,omitempty"`
	Confirm   bool   `yaml:"confirm,omitempty"`
	Language  string `yaml:"language,omitempty"`
	Namespace string `yaml:"namespace,omitempty"`
	Registry  string `yaml:"registry,omitempty"`
	Verbose   bool   `yaml:"verbose,omitempty"`
}

Global configuration settings.

func Load

func Load(path string) (c Global, err error)

Load the config exactly as it exists at path (no static defaults)

func New

func New() Global

New Config struct with all members set to static defaults. See NewDefaults for one which further takes into account the optional config file.

func NewDefault

func NewDefault() (cfg Global, err error)

NewDefault returns a config populated by global defaults as defined by the config file located in .Path() (the global func settings path, which is

usually ~/.config/func).

The config path is not required to be present.

func (Global) Apply added in v0.36.0

func (c Global) Apply(f fn.Function) Global

Apply populated values from a function to the config. The resulting config is global settings overridden by a given function.

func (Global) Configure added in v0.36.0

func (c Global) Configure(f fn.Function) fn.Function

Configure a function with poipulated values of the config. The resulting function is the function overridden by values on config.

func (Global) RegistryDefault added in v0.36.0

func (c Global) RegistryDefault() string

RegistyDefault is a convenience method for deferred calculation of a default registry taking into account both the global config file and cluster detection.

func (Global) Write added in v0.36.0

func (c Global) Write(path string) (err error)

Write the config to the given path

Jump to

Keyboard shortcuts

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