remove duplicated sutureservice code

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-06-02 12:01:17 +02:00
parent d3f1012fea
commit d347448ec0
37 changed files with 214 additions and 908 deletions

View File

@@ -1,13 +1,10 @@
package command
import (
"context"
"os"
"github.com/owncloud/ocis/v2/ocis-pkg/clihelper"
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/services/webdav/pkg/config"
"github.com/thejerf/suture/v4"
"github.com/urfave/cli/v2"
)
@@ -35,25 +32,3 @@ func Execute(cfg *config.Config) error {
return app.Run(os.Args)
}
// SutureService allows for the webdav command to be embedded and supervised by a suture supervisor tree.
type SutureService struct {
cfg *config.Config
}
// NewSutureService creates a new webdav.SutureService
func NewSutureService(cfg *ociscfg.Config) suture.Service {
cfg.WebDAV.Commons = cfg.Commons
return SutureService{
cfg: cfg.WebDAV,
}
}
func (s SutureService) Serve(ctx context.Context) error {
s.cfg.Context = ctx
if err := Execute(s.cfg); err != nil {
return err
}
return nil
}