forked from xluohome/smscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (33 loc) · 842 Bytes
/
main.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
package main
import (
"flag"
"fmt"
"os"
"runtime"
)
var (
config Config
configFile = flag.String("c", "etc/conf.yaml", "配置文件,默认etc/conf.yaml")
dbPath = flag.String("db", "level.db", "database path")
callbackworkers = flag.Int("cw", runtime.NumCPU(), "callback并发数,默认是cpu数")
trycallnums = flag.Int("cn", 10, "callback失败重试次数")
sms *SMS
SMSModel *Model
)
func init() {
flag.Usage = func() {
fmt.Printf("Usage %s -c=etc/conf.yaml -db level.db -cw 10 -cn 10", os.Args[0])
flag.PrintDefaults()
}
flag.Parse()
if err := config.ParseConfigFile(*configFile); err != nil {
fmt.Printf("%s,%s", "配置文件加载错误", err)
os.Exit(1)
}
sms = NewSms()
SMSModel = NewModel(sms)
RunCallbackTask()
}
func main() {
Apiserver()
}