Trim space from env variables (#1399)

This commit is contained in:
Jake Sanders 2020-03-24 14:51:43 +00:00 committed by GitHub
parent 84b4eb5404
commit 914340585c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,7 @@ import (
"net/url" "net/url"
"os" "os"
"strconv" "strconv"
"strings"
"time" "time"
"github.com/micro/go-micro/v2/store" "github.com/micro/go-micro/v2/store"
@ -79,9 +80,9 @@ type apiMessage struct {
// getOptions returns account id, token and namespace // getOptions returns account id, token and namespace
func getOptions() (string, string, string) { func getOptions() (string, string, string) {
accountID := os.Getenv("CF_ACCOUNT_ID") accountID := strings.TrimSpace(os.Getenv("CF_ACCOUNT_ID"))
apiToken := os.Getenv("CF_API_TOKEN") apiToken := strings.TrimSpace(os.Getenv("CF_API_TOKEN"))
namespace := os.Getenv("KV_NAMESPACE_ID") namespace := strings.TrimSpace(os.Getenv("KV_NAMESPACE_ID"))
return accountID, apiToken, namespace return accountID, apiToken, namespace
} }