21
"github.com/cubefs/cubefs/blobstore/common/config"
22
"github.com/cubefs/cubefs/blobstore/common/rpc"
23
"github.com/cubefs/cubefs/blobstore/common/rpc/auditlog"
24
"github.com/cubefs/cubefs/blobstore/common/rpc/example"
25
"github.com/cubefs/cubefs/blobstore/util/log"
30
LogLevel log.Level `json:"log_level"`
31
AuditLog auditlog.Config `json:"auditlog"`
34
BindAddr string `json:"bind_addr"`
35
App example.AppConfig `json:"app"`
38
BindAddr string `json:"bind_addr"`
41
BindAddr string `json:"bind_addr"`
46
config.Init("f", "", "main.conf")
49
err := config.Load(&conf)
53
log.SetOutputLevel(conf.LogLevel)
55
os.MkdirAll(conf.AuditLog.LogDir, 0o644)
56
lh, lf, _ := auditlog.Open("RPC", &conf.AuditLog)
61
httpServer := &http.Server{
63
Handler: rpc.MiddlewareHandlerWith(example.NewMetaHandler(), lh),
66
log.Info("meta server is running at:", c.BindAddr)
68
if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
69
log.Panic("meta server exits:", err)
75
httpServer := &http.Server{
77
Handler: rpc.MiddlewareHandlerWith(example.NewFileHandler(), lh),
80
log.Info("file server is running at:", c.BindAddr)
82
if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
83
log.Panic("file server exits:", err)
89
httpServer := &http.Server{
91
Handler: rpc.MiddlewareHandlerWith(example.NewAppHandler(c.App), lh),
94
log.Info("app server is running at:", c.BindAddr)
96
if err := httpServer.ListenAndServe(); err != nil && err != http.ErrServerClosed {
97
log.Panic("app server exits:", err)
102
<-make(chan struct{})