blob: 7b50f4641a337947d0ec46088483adba88aa701c [file] [log] [blame]
Samuel A. Falvo II704a7502013-07-10 15:23:43 -07001package main
2
3import (
4 "fmt"
5 "os"
6)
7
8// getCredentials will verify existence of needed credential information
9// provided through environment variables. This function will not return
10// if at least one piece of required information is missing.
11func getCredentials() (provider, username, password string) {
12 provider = os.Getenv("SDK_PROVIDER")
13 username = os.Getenv("SDK_USERNAME")
14 password = os.Getenv("SDK_PASSWORD")
15
16 if (provider == "") || (username == "") || (password == "") {
17 fmt.Fprintf(os.Stderr, "One or more of the following environment variables aren't set:\n")
18 fmt.Fprintf(os.Stderr, " SDK_PROVIDER=\"%s\"\n", provider)
19 fmt.Fprintf(os.Stderr, " SDK_USERNAME=\"%s\"\n", username)
20 fmt.Fprintf(os.Stderr, " SDK_PASSWORD=\"%s\"\n", password)
21 os.Exit(1)
22 }
23
24 return
25}