Documentation ¶
Index ¶
- Variables
- func AdminAPIKey(input string) error
- type Config
- func (c *Config) ApplicationIDExists(appID string) (bool, string)
- func (c *Config) ConfiguredProfiles() []*Profile
- func (c *Config) Default() *Profile
- func (c *Config) GetConfigFolder(xdgPath string) string
- func (c *Config) InitConfig()
- func (c *Config) Profile() *Profile
- func (c *Config) ProfileExists(appName string) bool
- func (c *Config) ProfileNames() []string
- func (c *Config) RemoveProfile(name string) error
- func (c *Config) SetDefaultProfile(name string) error
- type IConfig
- type Profile
- func (p *Profile) Add() error
- func (p *Profile) GetAPIKey() (string, error)
- func (p *Profile) GetAdminAPIKey() (string, error)
- func (p *Profile) GetApplicationID() (string, error)
- func (p *Profile) GetCrawlerAPIKey() (string, error)
- func (p *Profile) GetCrawlerUserID() (string, error)
- func (p *Profile) GetFieldName(field string) string
- func (p *Profile) GetSearchHosts() []string
- func (p *Profile) LoadDefault()
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAPIKeyNotConfigured is the error returned when the loaded profile is missing the api_key property ErrAPIKeyNotConfigured = errors.New("you have not configured your API key yet") // ErrApplicationIDNotConfigured is the error returned when the loaded profile is missing the application_id property ErrApplicationIDNotConfigured = errors.New("you have not configured your Application ID yet") // ErrCrawlerAPIKeyNotConfigured is the error returned when the loaded profile is missing the crawler_api_key property ErrCrawlerAPIKeyNotConfigured = errors.New("you have not configured your Crawler API key yet") // ErrCrawlerUserIDNotConfigured is the error returned when the loaded profile is missing the crawler_user_id property ErrCrawlerUserIDNotConfigured = errors.New("you have not configured your Crawler user ID yet") )
Functions ¶
func AdminAPIKey ¶
AdminAPIKey validates that a string looks like an Admin API key.
Types ¶
type Config ¶
Config handles all overall configuration for the CLI
func (*Config) ApplicationIDExists ¶
ApplicationIDExists check if an application ID exists in any profiles
func (*Config) ConfiguredProfiles ¶
ConfiguredProfiles return the profiles in the configuration file
func (*Config) GetConfigFolder ¶
GetConfigFolder retrieves the folder where the configuration file is stored It searches for the xdg environment path first and will secondarily place it in the home directory
func (*Config) InitConfig ¶
func (c *Config) InitConfig()
InitConfig reads in profiles file and ENV variables if set.
func (*Config) ProfileExists ¶
ProfileExists check if a profile with the given name exists
func (*Config) ProfileNames ¶
ProfileNames returns the list of name of the configured profiles
func (*Config) RemoveProfile ¶
RemoveProfile remove a profile from the configuration
func (*Config) SetDefaultProfile ¶
SetDefaultProfile set the default profile
type Profile ¶
type Profile struct { Name string ApplicationID string `mapstructure:"application_id"` APIKey string `mapstructure:"api_key"` AdminAPIKey string `mapstructure:"admin_api_key"` // Legacy SearchHosts []string `mapstructure:"search_hosts"` Default bool `mapstructure:"default"` }
func (*Profile) GetAdminAPIKey ¶
func (*Profile) GetApplicationID ¶
func (*Profile) GetCrawlerAPIKey ¶ added in v1.4.0
GetCrawlerAPIKey returns the Crawler API key.
func (*Profile) GetCrawlerUserID ¶ added in v1.4.0
GetCrawlerUserID returns the Crawler user ID.
func (*Profile) GetFieldName ¶
func (*Profile) GetSearchHosts ¶ added in v1.3.5
func (*Profile) LoadDefault ¶
func (p *Profile) LoadDefault()