-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_env.go
52 lines (50 loc) · 1.23 KB
/
setup_env.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 main
var (
envTitle = "Refoto"
envContact = ""
envDebug = false
envMySQLDSN = ""
envAdminToken = ""
envSecret = ""
envOSSBucket = ""
envOSSEndpoint = ""
envOSSAccessKeyID = ""
envOSSAccessKeySecret = ""
envOSSPublicEndpoint = ""
)
func setupEnv() (err error) {
if err = envStr("REFOTO_TITLE", &envTitle); err != nil {
return
}
if err = envStr("REFOTO_CONTACT", &envContact); err != nil {
return
}
if err = envBool("REFOTO_DEBUG", &envDebug); err != nil {
return
}
if err = envStr("REFOTO_MYSQL_DSN", &envMySQLDSN); err != nil {
return
}
if err = envStr("REFOTO_SECRET", &envSecret); err != nil {
return
}
if err = envStr("REFOTO_ADMIN_TOKEN", &envAdminToken); err != nil {
return
}
if err = envStr("REFOTO_OSS_BUCKET", &envOSSBucket); err != nil {
return
}
if err = envStr("REFOTO_OSS_ENDPOINT", &envOSSEndpoint); err != nil {
return
}
if err = envStr("REFOTO_OSS_AK_ID", &envOSSAccessKeyID); err != nil {
return
}
if err = envStr("REFOTO_OSS_AK_SECRET", &envOSSAccessKeySecret); err != nil {
return
}
if err = envStr("REFOTO_OSS_PUBLIC_ENDPOINT", &envOSSPublicEndpoint); err != nil {
return
}
return
}