Documentation ¶
Overview ¶
Package config contains types and functions for managing the user's local configuration for the command-line interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConfigExists = errors.New("config exists")
ErrConfigExists is the error given when a configuration file is already present in the config directory.
var ErrNoConfiguration = errors.New("no configuration file")
ErrNoConfiguration is the error given when a configuration file cannot be found in the config directory.
Functions ¶
func Create ¶
Create a new configuration file in the config directory containing the contents of the given Config type. The location of the configuration file changes based on the host operating system. See the documentation for os.UserConfigDir for specifics on where the config file is written to. Returns ErrConfigExists if a config file already exists.
Types ¶
type Config ¶
type Config struct { // Organization denotes the user's selected organization. Organization string `json:"organization"` }
The Config type describes the structure of the user's local configuration file. These values are used for performing operations against the control-plane API.
func FromContext ¶
FromContext attempts to obtain a Config type contained within the provided context.Context. The boolean return value is used to indicate if the context contains a Config.
func Load ¶
Load the configuration file from the config directory, decoding it into a Config type. The location of the configuration file changes based on the host operating system. See the documentation for os.UserConfigDir for specifics on where the config file is loaded from. Returns ErrNoConfiguration if the config file cannot be found.