-
Notifications
You must be signed in to change notification settings - Fork 0
/
vars.go
46 lines (39 loc) · 768 Bytes
/
vars.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
package vars
import (
"os"
"sync/atomic"
"time"
"github.com/coocood/freecache"
"github.com/robfig/cron/v3"
"github.com/speps/go-hashids"
"gorm.io/gorm"
)
var (
ListenAddress string
DebugMode bool
DataDir string
BaseURL string
BootTime time.Time
CacheDir string
MaxCacheSize int64
S3Setting S3SettingS
Database *gorm.DB
HashId *hashids.HashID
MemoryCache *freecache.Cache
CronInstance *cron.Cron
UploadPassword string
CdnAssetsPrefix string
Motd string
ServeByteCounter atomic.Uint64
ServeClickCounter atomic.Uint64
)
func Getenv(name string) string {
val := os.Getenv(name)
if len(val) > 0 {
return val
}
if val, ok := defaultEnvVar[name]; ok {
return val
}
return ""
}