Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Keys = []string{"dashboard_url", "api_url"}
Keys are all of the allowed keys in the Context section.
Functions ¶
func IsConfigured ¶
func IsConfigured() bool
IsConfigured returns true if a Common Fate config file exists and contains a non-empty current context.
config.Load() is called to load the config file.
Types ¶
type Config ¶
type Config struct { CurrentContext string `toml:"current_context" json:"current_context"` // Contexts allows multiple Common Fate tenancies to be switched between easily. // We don't have official support for this yet in the CLI, // but the config structure supports it so that it can be easily added in future. Contexts map[string]Context `toml:"context" json:"context"` }
func (Config) Current ¶
Current loads the current context as specified in the 'current_context' field in the config file. It returns an error if there are no contexts, or if the 'current_context' field doesn't match any contexts defined in the config file.
func (Config) CurrentOrEmpty ¶
CurrentOrEmpty returns the current context, or an empty context if it can't be found.
func (Config) DashboardURLs ¶
DashboardURLs returns all of the dashboard URLs available across different contexts.
type Context ¶
type Context struct { DashboardURL string `toml:"dashboard_url" json:"dashboard_url"` APIURL string `toml:"api_url,omitempty" json:"api_url,omitempty"` RegistryAPIURL string `toml:"registry_api_url,omitempty" json:"registry_api_url,omitempty"` }
func CurrentContext ¶
CurrentContext is a shorthand function which calls Load() to load the configuration, and then calls cfg.Current() to get the current API context. It returns an error if either method fails.
type Exports ¶
type Exports struct { AuthURL string `toml:"auth_url" json:"auth_url"` TokenURL string `toml:"token_url" json:"token_url"` APIURL string `toml:"api_url" json:"api_url"` RegistryAPIURL string `toml:"registry_api_url" json:"registry_api_url"` ClientID string `toml:"client_id" json:"client_id"` DashboardURL string `toml:"dashboard_url" json:"dashboard_url"` }
Exports are public configuration variables related to a Common Fate tenancy.