forked from Terry-Mao/bfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (41 loc) · 852 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
package main
import (
"bfs/directory/conf"
"flag"
"runtime"
log "github.com/golang/glog"
)
var (
configFile string
)
func init() {
flag.StringVar(&configFile, "c", "./directory.toml", " set directory config file path")
}
func main() {
var (
c *conf.Config
d *Directory
err error
)
flag.Parse()
defer log.Flush()
runtime.GOMAXPROCS(runtime.NumCPU())
log.Infof("bfs directory start")
if c, err = conf.NewConfig(configFile); err != nil {
log.Errorf("NewConfig(\"%s\") error(%v)", configFile, err)
return
}
log.Infof("new directory...")
if d, err = NewDirectory(c); err != nil {
log.Errorf("NewDirectory() failed, Quit now error(%v)", err)
return
}
log.Infof("init http api...")
StartApi(c.ApiListen, d)
if c.PprofEnable {
log.Infof("init http pprof...")
StartPprof(c.PprofListen)
}
StartSignal()
return
}