-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.go
35 lines (28 loc) · 890 Bytes
/
boot.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
package scarf
import (
"github.com/go-nacelle/nacelle"
"github.com/go-nacelle/scarf/logging"
)
// BootAndExit creates a nacelle Bootstrapper with the given name and
// initializes and starts a gRPC server with the given endpoint set. This
// method does not return.
func BootAndExit(name string, endpointSet EndpointSet) {
boostrapper := nacelle.NewBootstrapper(
name,
setupFactory(endpointSet),
)
boostrapper.BootAndExit()
}
func setupFactory(endpointSet EndpointSet) func(nacelle.ProcessContainer, nacelle.ServiceContainer) error {
return func(processes nacelle.ProcessContainer, services nacelle.ServiceContainer) error {
processes.RegisterInitializer(
logging.NewInitializer(DefaultExtractors),
nacelle.WithInitializerName("log decorator"),
)
processes.RegisterProcess(
NewServer(endpointSet),
nacelle.WithProcessName("server"),
)
return nil
}
}