-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (37 loc) · 860 Bytes
/
main.go
File metadata and controls
43 lines (37 loc) · 860 Bytes
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
package isp_python_wrapper_kit
import (
"github.com/txix-open/isp-python-wrapper-kit/assembly"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/shutdown"
)
func Main[T any](
version string,
remoteConfig any,
endpoints []cluster.EndpointDescriptor,
requiredModules []string,
) {
boot := bootstrap.New(
version,
remoteConfig,
endpoints,
cluster.HttpTransport,
)
app := boot.App
logger := app.Logger()
assembly, err := assembly.New[T](boot, requiredModules)
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)
}
}