MCPcopy
hub / github.com/cloudfoundry/cli / GetAPI

Function GetAPI

integration/helpers/login.go:45–55  ·  view source on GitHub ↗

GetAPI gets the value of the CF_INT_API environment variable, if set, and prefixes it with "https://" if the value doesn't already start with "http". If the variable is not set, returns "https://api.bosh-lite.com".

()

Source from the content-addressed store, hash-verified

43// it with "https://" if the value doesn't already start with "http". If the variable
44// is not set, returns "https://api.bosh-lite.com".
45func GetAPI() string {
46 apiURL := os.Getenv("CF_INT_API")
47 if apiURL == "" {
48 return "https://api.bosh-lite.com"
49 }
50 if !strings.HasPrefix(apiURL, "http") {
51 apiURL = fmt.Sprintf("https://%s", apiURL)
52 }
53
54 return apiURL
55}
56
57// LoginAs logs into the CLI with 'cf auth' and the given username and password,
58// retrying up to 3 times on failures.

Callers 4

runner_test.goFile · 0.92
SetAPIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected