-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
36 lines (30 loc) · 921 Bytes
/
config.go
File metadata and controls
36 lines (30 loc) · 921 Bytes
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
package main
import (
"github.com/spf13/viper"
)
type workServerConfig struct {
address string
isDebug bool
tokenKey string
timerWorkDispatchChanCache int
timerWorkChanCache int
timerWorkCount int
}
var (
conf *workServerConfig
)
func readConfiguration() {
viper.AddConfigPath("./")
viper.SetConfigName("config")
if err := viper.ReadInConfig(); err != nil {
panic(err)
}
conf = &workServerConfig{
address: viper.GetString("server.address"),
isDebug: viper.GetBool("server.debug"),
tokenKey: viper.GetString("middleware.jwt.tokenkey"),
timerWorkDispatchChanCache: viper.GetInt("timerwork.dispatch.chancache"),
timerWorkChanCache: viper.GetInt("timerwork.work.chancache"),
timerWorkCount: viper.GetInt("timerwork.work.count"),
}
}