-
Notifications
You must be signed in to change notification settings - Fork 29
/
common_test.go
52 lines (44 loc) · 1.12 KB
/
common_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
package auth
import (
"os"
"strconv"
)
var testConfig struct {
Server string
Port int
TLSPort int
BindUPN string
BindPass string
BindSecurity SecurityType
BaseDN string
PasswordUPN string
}
func init() {
testConfig.Server = os.Getenv("ADTEST_SERVER")
if port, err := strconv.Atoi(os.Getenv("ADTEST_PORT")); err == nil {
testConfig.Port = port
} else {
testConfig.Port = 389
}
if port, err := strconv.Atoi(os.Getenv("ADTEST_TLS_PORT")); err == nil {
testConfig.TLSPort = port
} else {
testConfig.TLSPort = 636
}
testConfig.BindUPN = os.Getenv("ADTEST_BIND_UPN")
testConfig.BindPass = os.Getenv("ADTEST_BIND_PASS")
switch os.Getenv("ADTEST_BIND_SECURITY") {
case "NONE":
testConfig.BindSecurity = SecurityNone
case "TLS":
testConfig.BindSecurity = SecurityTLS
case "INSECURETLS":
testConfig.BindSecurity = SecurityInsecureTLS
case "INSECURESTARTTLS":
testConfig.BindSecurity = SecurityInsecureStartTLS
default:
testConfig.BindSecurity = SecurityStartTLS
}
testConfig.BaseDN = os.Getenv("ADTEST_BASEDN")
testConfig.PasswordUPN = os.Getenv("ADTEST_PASSWORD_UPN")
}