-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
50 lines (39 loc) · 1.24 KB
/
config.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
package main
import (
"time"
"github.com/rotisserie/eris"
)
var CFG InitConfig
type InitConfig struct {
LogLevel string `env:"LOG_LVL" env-default:"INFO"`
ProxyTG string `env:"TG_PROXY"`
TgApiToken string `env:"TG_TOKEN"`
UserList []int64 `env:"LIST_USER"`
AdminList []int64 `env:"LIST_ADMIN"`
NotifyList []int64 `env:"LIST_NOTIFY"`
ErrorList []int64 `env:"LIST_ERROR"`
TimeLocation MyTimeLocation `env:"LOC" env-default:"UTC"`
NameDB string `env:"NAME_DB" env-default:"tgbotTemplate"`
MongoUrl string `env:"MONGO_URL" env-default:"mongodb://127.0.0.1:27017"`
// TG Webhook
IP string `env:"WH_IP"`
Path string `env:"WH_PATH"`
Port string `env:"WH_PORT" env-default:"8443"`
LocalPort string `env:"WH_LOCAL_PORT"`
SecretToken string `env:"WH_SEC"`
// Ping
PingPort string `env:"PING_PORT" env-default:"6970"`
PingOn bool `env:"PING_ON" env-default:"false"`
}
type MyTimeLocation string
func (l *MyTimeLocation) SetValue(s string) error {
*l = MyTimeLocation(s)
return nil
}
func (l MyTimeLocation) Get() *time.Location {
loc, err := time.LoadLocation(string(l))
if err != nil {
panic(eris.Wrap(err, "cfg.GetTimeLocation()"))
}
return loc
}