Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigChange ¶
ConfigChange checks periodically (checkInterval) if the configuration of the application changed. As soon as there is a difference a new Config object is send into the created Config output channel.
Note that it is not guaranteed to have all updates to the config in the output channel. If for example multiple changes of the configuration occur within one checkInterval then only the latest one will be send out.
Types ¶
type Config ¶
type Config map[string]interface{}
Configuration from config server
func FetchConfig ¶
FetchConfig returns the configuration given by the PCF Config Server which is bound as service to the app.
func FetchConfigByLabel ¶
FetchConfigByLabel returns the configuration from the PCF Config Server for a specifc label. The default label is "master" which is used by FetchConfig(). The label represents for a git configuration typically a branch name.
type ConfigServerResponse ¶
type ConfigServerResponse struct { Name string `json:"name"` Profiles []string `json:"profiles"` Label string `json:"label"` Version string `json:"version"` // State interface{} `json:"state"` PropertySources []struct { // Name is the path to the github repository for example Name string `json:"name"` // Source contains the actual configuration (float64 for ints) Source map[string]interface{} `json:"source"` // Rest of the fields should go here. } `json:"propertySources"` }
ConfigServerResponse encodes is the expected JSON response of the Configuration Server.
type Credentials ¶
Credentials are used in order to access the PCF Config Server with oauth2.
func GetConfigServerCredentialsFromEnv ¶
func GetConfigServerCredentialsFromEnv() (*Credentials, error)
GetConfigServerCredentialsFromEnv returns oauth2 and other parameters (app name, space name) out of the PCF environment variables. They are required for accessing the PCF Configuration Server.
func GetServiceCredentialsFromEnv ¶
func GetServiceCredentialsFromEnv(service string) (*Credentials, error)
GetServiceCredentialsFromEnv returns oauth2 and other parameters (app name, space name) out of the PCF environment variables using the given label.
func (*Credentials) GetConfigurationFromServer ¶
func (c *Credentials) GetConfigurationFromServer() (map[string]interface{}, error)
GetConfigurationFromServer requests the current configuration from the Configuration Server using the given Credentials.