-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
49 lines (39 loc) · 964 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
47
48
49
package main
import (
"isp-lock-service/assembly"
"isp-lock-service/conf"
"isp-lock-service/routes"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
)
var (
version = "1.0.0"
)
// @title isp-lock-service
// @version 1.0.0
// @description Шаблон сервиса
// @license.name GNU GPL v3.0
// @host localhost:9000
// @BasePath /api/isp-lock-service
//go:generate swag init
//go:generate rm -f docs/swagger.json docs/docs.go
func main() {
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors())
app := boot.App
logger := app.Logger()
assembly, err := assembly.New(boot)
if err != nil {
boot.Fatal(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)
}
}