Documentation ¶
Index ¶
- Constants
- func DefaultDir() (string, error)
- func HasCustomLocation() bool
- type Config
- type File
- type IConfig
- type IConfigMock
- func (mock *IConfigMock) Load() (*Config, error)
- func (mock *IConfigMock) LoadCalls() []struct{}
- func (mock *IConfigMock) Location() (string, error)
- func (mock *IConfigMock) LocationCalls() []struct{}
- func (mock *IConfigMock) Remove() error
- func (mock *IConfigMock) RemoveCalls() []struct{}
- func (mock *IConfigMock) Save(config *Config) error
- func (mock *IConfigMock) SaveCalls() []struct{ ... }
- type KafkaConfig
- type ServiceConfigMap
- type ServiceRegistryConfig
Constants ¶
const EnvName = "RHOASCONFIG"
Variables ¶
This section is empty.
Functions ¶
func DefaultDir ¶
DefaultDir returns the default parent directory of the config file
Types ¶
type Config ¶
type Config struct { AccessToken string `json:"access_token,omitempty" doc:"Bearer access token."` RefreshToken string `json:"refresh_token,omitempty" doc:"Offline or refresh token."` MasAuthURL string `json:"mas_auth_url,omitempty"` MasAccessToken string `json:"mas_access_token,omitempty"` MasRefreshToken string `json:"mas_refresh_token,omitempty"` Services ServiceConfigMap `json:"services,omitempty"` APIUrl string `` /* 166-byte string literal not displayed */ AuthURL string `json:"auth_url,omitempty" doc:"URL of the authentication server"` ClientID string `json:"client_id,omitempty" doc:"OpenID client identifier."` Insecure bool `` /* 142-byte string literal not displayed */ Scopes []string `` /* 172-byte string literal not displayed */ Telemetry string `json:"telemetry,omitempty" doc:"Flag used to enable telemetry for user."` LastUpdated int64 `json:"last_updated,omitempty" doc:"Timestamp of the last update cli"` }
Config is a type which describes the properties which can be in the config
func (*Config) GetKafkaIdOk ¶
GetKafkaIdOk returns the current Kafka instance ID and whether it exists
func (*Config) GetServiceRegistryIdOk ¶
GetServiceRegistryIdOk returns the service registry instance ID and whether it exists or not
type File ¶
type File struct{}
File is a type which describes a config file
func (*File) Load ¶
Load loads the configuration from the configuration file. If the configuration file doesn't exist it will return an empty configuration object.
type IConfig ¶
type IConfig interface { Load() (*Config, error) Save(config *Config) error Remove() error Location() (string, error) }
IConfig is an interface which describes the functions needed to read/write from a config
type IConfigMock ¶
type IConfigMock struct { // LoadFunc mocks the Load method. LoadFunc func() (*Config, error) // LocationFunc mocks the Location method. LocationFunc func() (string, error) // RemoveFunc mocks the Remove method. RemoveFunc func() error // SaveFunc mocks the Save method. SaveFunc func(config *Config) error // contains filtered or unexported fields }
IConfigMock is a mock implementation of IConfig.
func TestSomethingThatUsesIConfig(t *testing.T) { // make and configure a mocked IConfig mockedIConfig := &IConfigMock{ LoadFunc: func() (*Config, error) { panic("mock out the Load method") }, LocationFunc: func() (string, error) { panic("mock out the Location method") }, RemoveFunc: func() error { panic("mock out the Remove method") }, SaveFunc: func(config *Config) error { panic("mock out the Save method") }, } // use mockedIConfig in code that requires IConfig // and then make assertions. }
func (*IConfigMock) LoadCalls ¶
func (mock *IConfigMock) LoadCalls() []struct { }
LoadCalls gets all the calls that were made to Load. Check the length with:
len(mockedIConfig.LoadCalls())
func (*IConfigMock) Location ¶
func (mock *IConfigMock) Location() (string, error)
Location calls LocationFunc.
func (*IConfigMock) LocationCalls ¶
func (mock *IConfigMock) LocationCalls() []struct { }
LocationCalls gets all the calls that were made to Location. Check the length with:
len(mockedIConfig.LocationCalls())
func (*IConfigMock) RemoveCalls ¶
func (mock *IConfigMock) RemoveCalls() []struct { }
RemoveCalls gets all the calls that were made to Remove. Check the length with:
len(mockedIConfig.RemoveCalls())
func (*IConfigMock) SaveCalls ¶
func (mock *IConfigMock) SaveCalls() []struct { Config *Config }
SaveCalls gets all the calls that were made to Save. Check the length with:
len(mockedIConfig.SaveCalls())
type KafkaConfig ¶
type KafkaConfig struct {
ClusterID string `json:"clusterId"`
}
KafkaConfig is the config for the Kafka service
type ServiceConfigMap ¶
type ServiceConfigMap struct { Kafka *KafkaConfig `json:"kafka,omitempty"` ServiceRegistry *ServiceRegistryConfig `json:"serviceregistry,omitempty"` }
ServiceConfigMap is a map of configs for the application services