-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.go
42 lines (34 loc) · 929 Bytes
/
application.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
package framework
import (
"github.com/cherry1c/arya-frame/pkg/auth"
"github.com/cherry1c/arya-frame/pkg/log"
"github.com/cherry1c/arya-frame/pkg/metric"
"github.com/cherry1c/arya-frame/pkg/recovery"
"github.com/cherry1c/arya-frame/pkg/server"
"github.com/cherry1c/arya-frame/pkg/trace"
syslog "log"
)
type Application struct {
}
func NewApplication() *Application {
return &Application{}
}
func (a *Application) Init() error {
initList := make([]func() error, 0)
initList = append(initList, auth.Init)
initList = append(initList, log.Init)
initList = append(initList, metric.Init)
initList = append(initList, recovery.Init)
initList = append(initList, trace.Init)
initList = append(initList, server.Init)
for _, f := range initList {
if err := f(); err != nil {
syslog.Fatalf("init failed err: %s\n", err.Error())
}
}
return nil
}
func (a *Application) Run() error {
server.Run()
return nil
}