-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickStart.go
39 lines (34 loc) · 1.15 KB
/
quickStart.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
package potens
import (
"github.com/kubex/potens-go/definition"
"github.com/kubex/potens-go/identity"
)
func QuickStartApp(name string) *Application {
return StartApp(name, nil, nil)
}
func StartApp(name string, ident *identity.AppIdentity, def *definition.AppDefinition) *Application {
app := NewApplication(name)
app.Log().Info("Starting Application " + name)
app.FatalErr(app.SetIdentity(ident))
app.Log().Info("Processed Identity")
app.FatalErr(app.SetDefinition(def))
app.Log().Info("Processed Definition")
app.FatalErr(app.CreateServer())
app.Log().Info("Created gRPC Server")
return app
}
func QuickStartService(name string) *Application {
return StartService(name, nil, nil)
}
func StartService(name string, ident *identity.AppIdentity, def *definition.AppDefinition) *Application {
app := NewService(name)
app.Log().Debug("Assuming service name " + app.ServiceKey())
app.Log().Info("Starting Service " + name)
app.FatalErr(app.SetIdentity(ident))
app.Log().Info("Processed Identity")
app.FatalErr(app.SetDefinition(def))
app.Log().Info("Processed Definition")
app.FatalErr(app.CreateServer())
app.Log().Info("Created gRPC Server")
return app
}