github.com/Venafi/vcert/v5@v5.10.2/test/context.go (about) 1 /* 2 * Copyright 2018 Venafi, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package test 18 19 import ( 20 "os" 21 ) 22 23 type Context struct { 24 TPPurl string 25 TPPuser string 26 TPPPassword string 27 TPPaccessToken string 28 TPPZone string 29 TPPZoneRestricted string 30 TPPZoneECDSA string 31 TPPRefreshToken string 32 ClientID string 33 CloudUrl string 34 CloudAPIkey string 35 CloudZone string 36 VAASzoneEC string 37 CloudZoneRestricted string 38 } 39 40 func GetEnvContext() *Context { 41 //TODO: should rewrite to our standart variable names, TPPURL, TPPUSER etc 42 c := &Context{} 43 44 c.TPPurl = os.Getenv("TPP_URL") 45 c.TPPuser = os.Getenv("TPP_USER") 46 c.TPPPassword = os.Getenv("TPP_PASSWORD") 47 c.ClientID = os.Getenv("CLIENT_ID") 48 c.TPPZone = os.Getenv("TPP_ZONE") 49 c.TPPZoneRestricted = os.Getenv("TPP_ZONE_RESTRICTED") 50 c.TPPZoneECDSA = os.Getenv("TPP_ZONE_ECDSA") 51 52 c.CloudUrl = os.Getenv("CLOUD_URL") 53 c.CloudAPIkey = os.Getenv("CLOUD_APIKEY") 54 c.CloudZone = os.Getenv("CLOUD_ZONE") 55 c.VAASzoneEC = os.Getenv("VAAS_ZONE_EC") 56 c.CloudZoneRestricted = os.Getenv("CLOUD_ZONE_RESTRICTED") 57 58 return c 59 }