-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_test.go
55 lines (49 loc) · 1.17 KB
/
setup_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package trivec_test
import (
"log"
"net/url"
"os"
"testing"
trivec "github.com/omniboost/go-trivec"
)
var (
client *trivec.Client
)
func TestMain(m *testing.M) {
baseURLExportServiceString := os.Getenv("BASE_URL_EXPORT_SERVICE")
baseURLLiteAPIString := os.Getenv("BASE_URL_LITE_API")
subscriptionKey := os.Getenv("SUBSCRIPTION_KEY")
serviceKey := os.Getenv("SERVICE_KEY")
serviceID := os.Getenv("SERVICE_ID")
appID := os.Getenv("APP_ID")
secret := os.Getenv("SECRET")
environment := os.Getenv("ENVIRONMENT")
debug := os.Getenv("DEBUG")
client = trivec.NewClient(nil, subscriptionKey, serviceKey, serviceID, appID)
if debug != "" {
client.SetDebug(true)
}
if secret != "" {
client.SetSecret(secret)
}
if baseURLExportServiceString != "" {
baseURL, err := url.Parse(baseURLExportServiceString)
if err != nil {
log.Fatal(err)
}
client.SetBaseURLExportService(*baseURL)
}
if baseURLLiteAPIString != "" {
baseURL, err := url.Parse(baseURLLiteAPIString)
if err != nil {
log.Fatal(err)
}
client.SetBaseURLLiteAPI(*baseURL)
}
if environment != "" {
client.SetEnvironment(environment)
}
client.SetDisallowUnknownFields(true)
m.Run()
os.Exit(0)
}