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
46package hemlock
import (
"fmt"
"os"
"time"
)
// CacheBustKey is the cache busting key
var CacheBustKey string
// Env returns the value of the 'name'd environment variable or an empty string
func Env(name string) string {
return os.Getenv(name)
}
// EnvOr will return the value for 'name' or the fallback if it doesn't exist
func EnvOr(name, fallback string) string {
value, ok := os.LookupEnv(name)
if !ok {
return fallback
}
return value
}
// EnvOrPanic will return the value for 'name' or panic if not present
func EnvOrPanic(name string) string {
value, ok := os.LookupEnv(name)
if !ok {
panic("Environment variable " + name + " must be set")
}
return value
}
// Version returns the semver version number of the Hemlock framework
func Version() string {
// TODO: Implement version tracking
return "0.0.1"
}
func init() {
CacheBustKey = fmt.Sprintf("%d", time.Now().Unix())
}