-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
48 lines (39 loc) · 1004 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
package main
import (
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/shutdown"
"isp-config-service/conf"
"isp-config-service/routes"
"isp-config-service/service/startup"
)
var (
version = "1.0.0"
)
// @title isp-config-service
// @version 3.0.0
// @description Модуль управления конфигурациями
// @license.name GNU GPL v3.0
// @host localhost:9000
// @BasePath /api/config
//go:generate swag init --parseDependency
//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()
startup, err := startup.New(boot)
if err != nil {
boot.Fatal(err)
}
app.AddRunners(startup)
app.AddClosers(startup.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)
}
}