leftover comment
This commit is contained in:
+12
-11
@@ -36,17 +36,17 @@ var (
|
|||||||
|
|
||||||
// Extensions are oCIS extension services
|
// Extensions are oCIS extension services
|
||||||
Extensions = []string{
|
Extensions = []string{
|
||||||
"glauth", // done
|
"glauth", // done
|
||||||
"idp", // done
|
"idp", // done
|
||||||
"ocs", // done
|
"ocs", // done
|
||||||
"onlyoffice", // done
|
"onlyoffice", // done
|
||||||
"proxy", // done
|
"proxy", // done
|
||||||
"settings", // done
|
"settings", // done
|
||||||
"store", // done
|
"store", // done
|
||||||
"storage-metadata", // done
|
"storage-metadata", // done
|
||||||
"storage-frontend", // done
|
"storage-frontend", // done
|
||||||
"storage-gateway",
|
"storage-gateway", // done
|
||||||
"storage-userprovider",
|
"storage-userprovider", // done
|
||||||
"storage-groupprovider",
|
"storage-groupprovider",
|
||||||
"storage-auth-basic",
|
"storage-auth-basic",
|
||||||
"storage-auth-bearer",
|
"storage-auth-bearer",
|
||||||
@@ -129,6 +129,7 @@ func (r *Runtime) Start() error {
|
|||||||
addServiceToken("webdav", supervisor.Add(webdav.NewSutureService(globalCtx, r.c.WebDAV)))
|
addServiceToken("webdav", supervisor.Add(webdav.NewSutureService(globalCtx, r.c.WebDAV)))
|
||||||
addServiceToken("frontend", supervisor.Add(storage.NewFrontend(globalCtx, r.c.Storage)))
|
addServiceToken("frontend", supervisor.Add(storage.NewFrontend(globalCtx, r.c.Storage)))
|
||||||
addServiceToken("gateway", supervisor.Add(storage.NewGateway(globalCtx, r.c.Storage)))
|
addServiceToken("gateway", supervisor.Add(storage.NewGateway(globalCtx, r.c.Storage)))
|
||||||
|
addServiceToken("users", supervisor.Add(storage.NewUsersProviderService(globalCtx, r.c.Storage)))
|
||||||
|
|
||||||
// TODO(refs) debug line with supervised services.
|
// TODO(refs) debug line with supervised services.
|
||||||
go supervisor.ServeBackground()
|
go supervisor.ServeBackground()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package command
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
"path"
|
||||||
@@ -205,3 +206,43 @@ func Users(cfg *config.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UsersProviderService allows for the storage-userprovider command to be embedded and supervised by a suture supervisor tree.
|
||||||
|
type UsersProviderService struct {
|
||||||
|
ctx context.Context
|
||||||
|
cancel context.CancelFunc // used to cancel the context go-micro services used to shutdown a service.
|
||||||
|
cfg *config.Config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewUsersProviderService creates a new gateway.UsersProviderService
|
||||||
|
func NewUsersProviderService(ctx context.Context, cfg *config.Config) UsersProviderService {
|
||||||
|
sctx, cancel := context.WithCancel(ctx)
|
||||||
|
cfg.Context = sctx
|
||||||
|
return UsersProviderService{
|
||||||
|
ctx: sctx,
|
||||||
|
cancel: cancel,
|
||||||
|
cfg: cfg,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s UsersProviderService) Serve() {
|
||||||
|
f := &flag.FlagSet{}
|
||||||
|
for k := range Users(s.cfg).Flags {
|
||||||
|
if err := Users(s.cfg).Flags[k].Apply(f); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx := cli.NewContext(nil, f, nil)
|
||||||
|
if Users(s.cfg).Before != nil {
|
||||||
|
if err := Users(s.cfg).Before(ctx); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := Users(s.cfg).Action(ctx); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s UsersProviderService) Stop() {
|
||||||
|
s.cancel()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user