This commit is contained in:
A.Unger
2021-03-09 13:10:05 +01:00
parent 9284c232b8
commit 757cb9abe9
9 changed files with 162 additions and 127 deletions
+6 -4
View File
@@ -5,6 +5,8 @@ import (
"os"
"strings"
"github.com/thejerf/suture"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/settings/pkg/config"
@@ -111,18 +113,18 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
// SutureService allows for the settings command to be embedded and supervised by a suture supervisor tree.
type SutureService struct {
ctx context.Context
cancel context.CancelFunc // used to cancel the context go-micro services used to shutdown a service.
cancel context.CancelFunc
cfg *config.Config
}
// NewSutureService creates a new settings.SutureService
func NewSutureService(ctx context.Context, cfg *config.Config) SutureService {
func NewSutureService(ctx context.Context, cfg interface{}) suture.Service {
sctx, cancel := context.WithCancel(ctx)
cfg.Context = sctx // propagate the context down to the go-micro services.
cfg.(*config.Config).Context = sctx
return SutureService{
ctx: sctx,
cancel: cancel,
cfg: cfg,
cfg: cfg.(*config.Config),
}
}