Documentation
¶
Overview ¶
Package configuration provides configuration management for the CLI.
Index ¶
- func GetDefaultConfigPath() (string, error)
- func ReadConfig(cmd *cobra.Command, expectedProfileType ProfileType, isLastStep ...bool) (*ResolvedProfile, *URLs, error)
- func SetAPIEndpoint(endpoint string) error
- type ActiveConfig
- type BaseConfig
- type Config
- func (c *Config) CreateProfile(name string, profileType ProfileType, endpoint, apiKey string) error
- func (c *Config) DeleteProfile(name string) error
- func (c *Config) GetActiveProfile() string
- func (c *Config) GetProfileWithUrls(profileName string) (*ResolvedProfile, *URLs, error)
- func (c *Config) ListProfiles() []string
- func (c *Config) LoadURL(filePath string, envName string) (*URLs, error)
- func (c *Config) ResolveProfile(profileName string) (*ResolvedProfile, error)
- func (c *Config) ResolveProfileAndURLs(cmd *cobra.Command, expectedProfileType ProfileType) (*ResolvedProfile, *URLs, error)
- func (c *Config) ResolveURLs(profileName string) (*URLs, error)
- func (c *Config) SaveConfig() error
- func (c *Config) SetActiveProfile(profileName string) error
- func (c *Config) UpdateAPIKey(name, apiKey string) error
- func (c *Config) UpdateProfile(name, refreshToken string) error
- func (c *Config) ValidateProfile(profileName string) error
- type OutputFormat
- type Profile
- type ProfileType
- type ResolvedProfile
- type URLs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultConfigPath ¶
func ReadConfig ¶
func ReadConfig(cmd *cobra.Command, expectedProfileType ProfileType, isLastStep ...bool) (*ResolvedProfile, *URLs, error)
func SetAPIEndpoint ¶
Types ¶
type ActiveConfig ¶
type ActiveConfig struct {
Profile string `toml:"profile"`
}
type BaseConfig ¶
type BaseConfig struct {
Endpoint string `toml:"endpoint"`
Output OutputFormat `toml:"output"`
}
type Config ¶
type Config struct {
Default BaseConfig `toml:"default"`
Active ActiveConfig `toml:"active"`
Profile map[string]*Profile `toml:"-"`
ConfigPath string `toml:"-"`
URLs *URLs `toml:"-"`
}
func LoadConfig ¶
func (*Config) CreateProfile ¶
func (c *Config) CreateProfile(name string, profileType ProfileType, endpoint, apiKey string) error
func (*Config) DeleteProfile ¶
func (*Config) GetActiveProfile ¶
func (*Config) GetProfileWithUrls ¶
func (c *Config) GetProfileWithUrls(profileName string) (*ResolvedProfile, *URLs, error)
func (*Config) ListProfiles ¶
func (*Config) ResolveProfile ¶
func (c *Config) ResolveProfile(profileName string) (*ResolvedProfile, error)
func (*Config) ResolveProfileAndURLs ¶
func (c *Config) ResolveProfileAndURLs(cmd *cobra.Command, expectedProfileType ProfileType) (*ResolvedProfile, *URLs, error)
func (*Config) SaveConfig ¶
func (*Config) SetActiveProfile ¶
func (*Config) UpdateAPIKey ¶
func (*Config) UpdateProfile ¶
func (*Config) ValidateProfile ¶
type OutputFormat ¶
type OutputFormat string
const ( OutputJSON OutputFormat = "json" OutputXML OutputFormat = "xml" OutputYAML OutputFormat = "yaml" OutputHuman OutputFormat = "human" )
type Profile ¶
type Profile struct {
Inherits string `toml:"inherits,omitempty"`
Type ProfileType `toml:"type"`
Endpoint string `toml:"endpoint,omitempty"`
Output OutputFormat `toml:"output,omitempty"`
APIKey string `toml:"api_key,omitempty"`
UpdatedAt time.Time `toml:"updated_at,omitempty"`
}
type ProfileType ¶
type ProfileType string
const ( ProfileTypeComposer ProfileType = "composer" ProfileTypeConsole ProfileType = "console" )
type ResolvedProfile ¶
type ResolvedProfile struct {
Name string
Type ProfileType
Endpoint string
Output OutputFormat
APIKey string
UpdatedAt time.Time
}
Click to show internal directories.
Click to hide internal directories.