-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (37 loc) · 864 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
package main
import (
"flag"
"io/ioutil"
"log"
"gopkg.in/yaml.v2"
"github.com/nexclipper/curlbee/cmd"
"github.com/nexclipper/curlbee/pkg/config"
)
func main() {
fileName := flag.String("filename", "", "yaml file name")
execType := flag.String("type", "cli", "specifies the type of execution process[cli(default)|http]")
param := flag.String("param", "", "parameters can be transferred")
flag.Parse()
//*execType = "http"
//*fileName = "./example/policy4.yml"
//fmt.Println(*fileName)
//fmt.Println(*param)
yamlBuf, err := ioutil.ReadFile(*fileName)
if err != nil {
panic(err)
}
cfg := &config.BeeConfig{}
err = yaml.Unmarshal(yamlBuf, cfg)
if err != nil {
panic(err)
}
bee := cmd.NewBee(*execType, *param)
if bee != nil {
err := bee.Run(cfg)
if err != nil {
panic(err)
}
} else {
log.Println("type is not valid")
}
}