panic?
This commit is contained in:
+15
-14
@@ -36,19 +36,19 @@ var (
|
||||
|
||||
// Extensions are oCIS extension services
|
||||
Extensions = []string{
|
||||
"glauth", // done
|
||||
"idp", // done
|
||||
"ocs", // done
|
||||
"onlyoffice", // done
|
||||
"proxy", // done
|
||||
"settings", // done
|
||||
"store", // done
|
||||
"storage-metadata", // done
|
||||
"storage-frontend", // done
|
||||
"storage-gateway", // done
|
||||
"storage-userprovider", // done
|
||||
"storage-groupprovider",
|
||||
"storage-auth-basic",
|
||||
"glauth", // done
|
||||
"idp", // done
|
||||
"ocs", // done
|
||||
"onlyoffice", // done
|
||||
"proxy", // done
|
||||
"settings", // done
|
||||
"store", // done
|
||||
"storage-metadata", // done
|
||||
"storage-frontend", // done
|
||||
"storage-gateway", // done
|
||||
"storage-userprovider", // done
|
||||
"storage-groupprovider", // done
|
||||
"storage-auth-basic", // done
|
||||
"storage-auth-bearer",
|
||||
"storage-home",
|
||||
"storage-users",
|
||||
@@ -130,7 +130,8 @@ func (r *Runtime) Start() error {
|
||||
addServiceToken("frontend", supervisor.Add(storage.NewFrontend(globalCtx, r.c.Storage)))
|
||||
addServiceToken("gateway", supervisor.Add(storage.NewGateway(globalCtx, r.c.Storage)))
|
||||
addServiceToken("users", supervisor.Add(storage.NewUsersProviderService(globalCtx, r.c.Storage)))
|
||||
addServiceToken("groups-provider", supervisor.Add(storage.NewGroupsProvider(globalCtx, r.c.Storage)))
|
||||
addServiceToken("groupsprovider", supervisor.Add(storage.NewGroupsProvider(globalCtx, r.c.Storage))) // TODO(refs) panic? are we sending to a nil / closed channel?
|
||||
addServiceToken("authbasic", supervisor.Add(storage.NewAuthBasic(globalCtx, r.c.Storage)))
|
||||
|
||||
// TODO(refs) debug line with supervised services.
|
||||
go supervisor.ServeBackground()
|
||||
|
||||
@@ -2,6 +2,7 @@ package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
@@ -190,3 +191,43 @@ func AuthBasic(cfg *config.Config) *cli.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// AuthBasicSutureService allows for the storage-authbasic command to be embedded and supervised by a suture supervisor tree.
|
||||
type AuthBasicSutureService struct {
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc // used to cancel the context go-micro services used to shutdown a service.
|
||||
cfg *config.Config
|
||||
}
|
||||
|
||||
// NewAuthBasicSutureService creates a new store.AuthBasicSutureService
|
||||
func NewAuthBasic(ctx context.Context, cfg *config.Config) AuthBasicSutureService {
|
||||
sctx, cancel := context.WithCancel(ctx)
|
||||
cfg.Context = sctx
|
||||
return AuthBasicSutureService{
|
||||
ctx: sctx,
|
||||
cancel: cancel,
|
||||
cfg: cfg,
|
||||
}
|
||||
}
|
||||
|
||||
func (s AuthBasicSutureService) Serve() {
|
||||
f := &flag.FlagSet{}
|
||||
for k := range AuthBasic(s.cfg).Flags {
|
||||
if err := AuthBasic(s.cfg).Flags[k].Apply(f); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx := cli.NewContext(nil, f, nil)
|
||||
if AuthBasic(s.cfg).Before != nil {
|
||||
if err := AuthBasic(s.cfg).Before(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if err := AuthBasic(s.cfg).Action(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (s AuthBasicSutureService) Stop() {
|
||||
s.cancel()
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ func Groups(cfg *config.Config) *cli.Command {
|
||||
ctx, cancel = context.WithCancel(context.Background())
|
||||
//metrics = metrics.New()
|
||||
)
|
||||
|
||||
defer cancel()
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user