Documentation ¶
Index ¶
Constants ¶
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 ¶
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 ¶
func DefaultNamespace() (namespace string)
DefaultNamespace for remote operations is the currently active context namespace (if available) or the fallback "default". Subsequently the value will be populated, indicating the namespace in which the function is currently deployed. Changes to this value will issue warnings to the user.
func Dir ¶
func Dir() (path string)
Dir is derived in the following order, from lowest to highest precedence.
- The default path is the zero value, indicating "no config path available", and users of this package should act accordingly.
- ~/.config/func if it exists (can be expanded: user has a home dir)
- The value of $XDG_CONFIG_PATH/func if the environment variable exists.
The path is created if it does not already exist.
func File ¶
func File() string
File returns the full path at which to look for a config file. Use FUNC_CONFIG_FILE to override default.
func Get ¶
Get the named global config value from the given global config struct. Nonexistent values return nil. Implemented as a package-static function because Set is implemented as such. See the long-winded explanation above.
func List ¶
func List() []string
List the globally configurable settings by the key which can be used in the accessors Get and Set, and in the associated disk serialized. Sorted. Implemented as a package-static function because Set is implemented as such. See the long-winded explanation above.
func RepositoriesPath ¶
func RepositoriesPath() string
RepositoriesPath returns the full path at which to look for repositories. Use FUNC_REPOSITORIES_PATH to override default.
Types ¶
type Global ¶
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"` RegistryInsecure bool `yaml:"registryInsecure,omitempty"` }
Global configuration settings.
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 ¶
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 Set ¶
Set value of a member by name and a stringified value. Fails if the passed value can not be coerced into the value expected by the member indicated by name.
func (Global) Apply ¶
Apply populated values from a function to the config. The resulting config is global settings overridden by a given function.
func (Global) Configure ¶
Configure a function with populated values of the config. The resulting function is the function overridden by values on config.
func (Global) RegistryDefault ¶
RegistyDefault is a convenience method for deferred calculation of a default registry taking into account both the global config file and cluster detection.