-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
48 lines (38 loc) · 1 KB
/
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
package main
import (
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
"msp-admin-service/assembly"
"msp-admin-service/conf"
"msp-admin-service/routes"
)
var version = "1.0.0"
// @title msp-admin-service
// @version 1.0.0
// @description сервис управления администраторами
// @license.name GNU GPL v3.0
// @host localhost:9000
// @BasePath /api/admin
//go:generate swag init
//go:generate rm -f docs/swagger.json
func main() {
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors())
app := boot.App
logger := app.Logger()
assembly, err := assembly.New(boot)
if err != nil {
logger.Fatal(app.Context(), err)
}
app.AddRunners(assembly.Runners()...)
app.AddClosers(assembly.Closers()...)
shutdown.On(func() {
logger.Info(app.Context(), "starting shutdown")
app.Shutdown()
logger.Info(app.Context(), "shutdown completed")
})
err = app.Run()
if err != nil {
app.Shutdown()
logger.Fatal(app.Context(), err)
}
}