|
@@ -74,6 +74,13 @@ func (f *AppFramework) ShutdownConsoleLogBackend() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (f *AppFramework) MustPrepare(processName string, fn func() error) {
|
|
|
+ err := fn()
|
|
|
+ if err != nil {
|
|
|
+ f.PanicF("failed prepare for '%s': %v", processName, err)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// AddSubSvc add a sub service
|
|
|
func (f *AppFramework) AddSubSvc(name string, svc core.ISubService) {
|
|
|
_, ok := f.subSvc.Get(name)
|
|
@@ -129,7 +136,7 @@ func (f *AppFramework) Run() error {
|
|
|
}
|
|
|
|
|
|
// RunWithContext start the app with custom context
|
|
|
-func (f AppFramework) RunWithContext(ctx context.Context) error {
|
|
|
+func (f *AppFramework) RunWithContext(ctx context.Context) error {
|
|
|
ctx, cncl := context.WithCancel(ctx)
|
|
|
f.gcncl = cncl
|
|
|
f.gctx = ctx
|