-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
48 lines (39 loc) · 1.07 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"
"isp-system-service/assembly"
"isp-system-service/conf"
"isp-system-service/routes"
)
var (
version = "1.0.0"
)
// @title isp-system-service
// @version 1.0.0
// @description Сервис управления реестром внешних приложений и токенами аутентификации
// @license.name GNU GPL v3.0
// @host localhost:9000
// @BasePath /api/system
//go:generate swag init --parseDependency
//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 {
boot.Fatal(err)
}
}