-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (37 loc) · 958 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
44
45
46
47
48
49
package main
import (
"flag"
"log"
"github.com/qiancijun/cheryl/cheryl"
"github.com/qiancijun/cheryl/config"
)
// func filter1(w http.ResponseWriter, r *http.Request) error {
// logger.Debug("filter1")
// return nil
// }
// func filter2(w http.ResponseWriter, r *http.Request) error {
// logger.Debug("filter2")
// return nil
// }
// func filter3(w http.ResponseWriter, r *http.Request) error {
// logger.Debug("filter3")
// return nil
// }
func main() {
configPath := flag.String("config", "config.yaml", "config path")
flag.Parse()
config, err := config.ReadConfig(*configPath)
if err != nil {
log.Fatalf("read config error: %s", err)
}
err = config.Validation()
if err != nil {
log.Fatalf("verify config error: %s", err)
}
// f1 := filter.NewFilter(filter1)
// f2 := filter.NewFilter(filter2)
// f3 := filter.NewFilter(filter3)
// filter.CreateFilterChain(f1, f2, f3)
cheryl.Start(config)
// config.StartServer()
}