-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv.go
41 lines (32 loc) · 1.03 KB
/
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
package main
import "os"
var secret = []byte(os.Getenv("GO_STATIC_SESSION_SECRET")) // long_secret_string
var wwwRoot = os.Getenv("GO_STATIC_WWW_ROOT") // $WORKSPACE/go-static-html/public
var host = os.Getenv("GO_STATIC_HOST") // localhost:8080
var storePath = os.Getenv("GO_STATIC_STORE_PATH") // $WORKSPACE/go-static-html/users.json
var urlHome = os.Getenv("GO_STATIC_URL_HOME") // /index.html
var urlLogin = os.Getenv("GO_STATIC_URL_LOGIN") // /#.go
var urlLoginHtml = os.Getenv("GO_STATIC_LOGIN_HTML") // $WORKSPACE/go-static-html/public/auth/#/index.html
func checkEnv() {
if len(secret) == 0 {
panic("Empty secret!")
}
if len(wwwRoot) == 0 {
panic("Empty wwwRoot!")
}
if len(host) == 0 {
panic("Empty host!")
}
if len(storePath) == 0 {
panic("Empty store path!")
}
if len(urlHome) == 0 {
panic("Empty home url")
}
if len(urlLogin) == 0 {
panic("Empty login url")
}
if len(urlLoginHtml) == 0 {
panic("Empty login html file path")
}
}