ensure commands for all services

This commit is contained in:
Willy Kloucek
2022-05-03 10:59:52 +02:00
parent f643de22c4
commit 977c4fd9e9
184 changed files with 5690 additions and 3268 deletions
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageAppProviderCommand is the entrypoint for the reva-app-provider command.
func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
// AppProviderCommand is the entrypoint for the app provider command.
func AppProviderCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-app-provider",
Usage: "start storage app-provider service",
Name: cfg.AppProvider.Service.Name,
Usage: subcommandDescription(cfg.AppProvider.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
cfg.AppProvider.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.AppProvider(cfg.AppProvider)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.AppProvider),
}
}
func init() {
register.AddCommand(StorageAppProviderCommand)
register.AddCommand(AppProviderCommand)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageAuthBasicCommand is the entrypoint for the reva-auth-basic command.
func StorageAuthBasicCommand(cfg *config.Config) *cli.Command {
// AuthBasicCommand is the entrypoint for the AuthBasic command.
func AuthBasicCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-auth-basic",
Usage: "start storage auth-basic service",
Name: cfg.AuthBasic.Service.Name,
Usage: subcommandDescription(cfg.AuthBasic.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageAuthBasicCommand(cfg *config.Config) *cli.Command {
cfg.AuthBasic.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.AuthBasic(cfg.AuthBasic)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.AuthBasic),
}
}
func init() {
register.AddCommand(StorageAuthBasicCommand)
register.AddCommand(AuthBasicCommand)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageAuthBearerCommand is the entrypoint for the reva-auth-bearer command.
func StorageAuthBearerCommand(cfg *config.Config) *cli.Command {
// AuthBearerCommand is the entrypoint for the AuthBearer command.
func AuthBearerCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-auth-bearer",
Usage: "Start storage auth-bearer service",
Name: cfg.AuthBearer.Service.Name,
Usage: subcommandDescription(cfg.AuthBearer.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageAuthBearerCommand(cfg *config.Config) *cli.Command {
cfg.AuthBearer.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.AuthBearer(cfg.AuthBearer)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.AuthBearer),
}
}
func init() {
register.AddCommand(StorageAuthBearerCommand)
register.AddCommand(AuthBearerCommand)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageAuthMachineCommand is the entrypoint for the reva-auth-machine command.
func StorageAuthMachineCommand(cfg *config.Config) *cli.Command {
// AuthMachineCommand is the entrypoint for the AuthMachine command.
func AuthMachineCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-auth-machine",
Usage: "start storage auth-machine service",
Name: cfg.AuthMachine.Service.Name,
Usage: subcommandDescription(cfg.AuthMachine.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageAuthMachineCommand(cfg *config.Config) *cli.Command {
cfg.AuthMachine.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.AuthMachine(cfg.AuthMachine)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.AuthMachine),
}
}
func init() {
register.AddCommand(StorageAuthMachineCommand)
register.AddCommand(AuthMachineCommand)
}
-13
View File
@@ -2,21 +2,8 @@ package command
import (
"fmt"
"github.com/urfave/cli/v2"
)
func handleOriginalAction(c *cli.Context, cmd *cli.Command) error {
if cmd.Before != nil {
if err := cmd.Before(c); err != nil {
return err
}
}
return cli.HandleAction(cmd.Action, c)
}
func subcommandDescription(serviceName string) string {
return fmt.Sprintf("%s extension commands", serviceName)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageFrontendCommand is the entrypoint for the reva-frontend command.
func StorageFrontendCommand(cfg *config.Config) *cli.Command {
// FrontendCommand is the entrypoint for the Frontend command.
func FrontendCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-frontend",
Usage: "start storage frontend",
Name: cfg.Frontend.Service.Name,
Usage: subcommandDescription(cfg.Frontend.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageFrontendCommand(cfg *config.Config) *cli.Command {
cfg.Frontend.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.Frontend(cfg.Frontend)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.Frontend),
}
}
func init() {
register.AddCommand(StorageFrontendCommand)
register.AddCommand(FrontendCommand)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageGatewayCommand is the entrypoint for the reva-gateway command.
func StorageGatewayCommand(cfg *config.Config) *cli.Command {
// GatewayCommand is the entrypoint for the Gateway command.
func GatewayCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-gateway",
Usage: "start storage gateway",
Name: cfg.Gateway.Service.Name,
Usage: subcommandDescription(cfg.Gateway.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageGatewayCommand(cfg *config.Config) *cli.Command {
cfg.Gateway.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.Gateway(cfg.Gateway)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.Gateway),
}
}
func init() {
register.AddCommand(StorageGatewayCommand)
register.AddCommand(GatewayCommand)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageGroupProviderCommand is the entrypoint for the storage-groupprovider command.
func StorageGroupProviderCommand(cfg *config.Config) *cli.Command {
// GroupCommand is the entrypoint for the Group command.
func GroupCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-groupprovider",
Usage: "start storage groupprovider service",
Name: cfg.Group.Service.Name,
Usage: subcommandDescription(cfg.Group.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageGroupProviderCommand(cfg *config.Config) *cli.Command {
cfg.Group.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.Groups(cfg.Group)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.Group),
}
}
func init() {
register.AddCommand(StorageGroupProviderCommand)
register.AddCommand(GroupCommand)
}
+4 -7
View File
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// OCDavCommand is the entrypoint for the ocdav command.
// OCDavCommand is the entrypoint for the OCDav command.
func OCDavCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "ocdav",
Usage: "start ocdav",
Name: cfg.OCDav.Service.Name,
Usage: subcommandDescription(cfg.OCDav.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,10 +24,7 @@ func OCDavCommand(cfg *config.Config) *cli.Command {
cfg.OCDav.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.OCDav(cfg.OCDav)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.OCDav),
}
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageSharingCommand is the entrypoint for the reva-sharing command.
func StorageSharingCommand(cfg *config.Config) *cli.Command {
// SharingCommand is the entrypoint for the Sharing command.
func SharingCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-sharing",
Usage: "start storage sharing service",
Name: cfg.Sharing.Service.Name,
Usage: subcommandDescription(cfg.Sharing.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,13 +24,10 @@ func StorageSharingCommand(cfg *config.Config) *cli.Command {
cfg.Sharing.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.Sharing(cfg.Sharing)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.Sharing),
}
}
func init() {
register.AddCommand(StorageSharingCommand)
register.AddCommand(SharingCommand)
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageMetadataCommand is the entrypoint for the storage-metadata command.
// StorageMetadataCommand is the entrypoint for the StorageMetadata command.
func StorageMetadataCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-metadata",
Usage: "start storage and data service for metadata",
Name: cfg.StorageMetadata.Service.Name,
Usage: subcommandDescription(cfg.StorageMetadata.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,10 +24,7 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command {
cfg.StorageMetadata.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.StorageMetadata(cfg.StorageMetadata)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.StorageMetadata),
}
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StoragePublicLinkCommand is the entrypoint for the reva-storage-oc command.
// StoragePublicLinkCommand is the entrypoint for the StoragePublicLink command.
func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-public-link",
Usage: "start storage public link storage",
Name: cfg.StoragePublicLink.Service.Name,
Usage: subcommandDescription(cfg.StoragePublicLink.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,10 +24,7 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
cfg.StoragePublicLink.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.StoragePublicLink(cfg.StoragePublicLink)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.StoragePublicLink),
}
}
@@ -10,11 +10,11 @@ import (
"github.com/urfave/cli/v2"
)
// StorageSharesCommand is the entrypoint for the storage-shares command.
// StorageSharesCommand is the entrypoint for the StorageShares command.
func StorageSharesCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-shares",
Usage: "start storage and data provider for shares jail",
Name: cfg.StorageShares.Service.Name,
Usage: subcommandDescription(cfg.StorageShares.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
@@ -24,10 +24,7 @@ func StorageSharesCommand(cfg *config.Config) *cli.Command {
cfg.StorageShares.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.StorageShares(cfg.StorageShares)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.StorageShares),
}
}
+33
View File
@@ -0,0 +1,33 @@
package command
import (
"fmt"
"github.com/owncloud/ocis/extensions/storage-users/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
// StorageUsersCommand is the entrypoint for the StorageUsers command.
func StorageUsersCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: cfg.StorageUsers.Service.Name,
Usage: subcommandDescription(cfg.StorageUsers.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.StorageUsers.Commons = cfg.Commons
return nil
},
Subcommands: command.GetCommands(cfg.StorageUsers),
}
}
func init() {
register.AddCommand(StorageUsersCommand)
}
-25
View File
@@ -1,25 +0,0 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage-users/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
// StorageUsersCommand is the entrypoint for the storage-users command.
func StorageUsersCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-users",
Usage: "start storage and data provider for /users mount",
Category: "extensions",
Action: func(c *cli.Context) error {
origCmd := command.StorageUsers(cfg.StorageUsers)
return handleOriginalAction(c, origCmd)
},
}
}
func init() {
register.AddCommand(StorageUsersCommand)
}
@@ -10,27 +10,24 @@ import (
"github.com/urfave/cli/v2"
)
// StorageUserProviderCommand is the entrypoint for the storage-userprovider command.
func StorageUserProviderCommand(cfg *config.Config) *cli.Command {
// UserCommand is the entrypoint for the User command.
func UserCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-userprovider",
Usage: "start storage userprovider service",
Name: cfg.User.Service.Name,
Usage: subcommandDescription(cfg.User.Service.Name),
Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.StorageUsers.Commons = cfg.Commons
cfg.User.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error {
origCmd := command.User(cfg.User)
return handleOriginalAction(c, origCmd)
},
Subcommands: command.GetCommands(cfg.User),
}
}
func init() {
register.AddCommand(StorageUserProviderCommand)
register.AddCommand(UserCommand)
}
+1 -5
View File
@@ -56,8 +56,7 @@ type IdmExtension struct {
}
type FrontendExtension struct {
Archiver InsecureExtension
AppProvider InsecureExtension `yaml:"app_provider"`
Archiver InsecureExtension
}
type AuthbasicExtension struct {
@@ -256,9 +255,6 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
},
}
cfg.Frontend = FrontendExtension{
AppProvider: InsecureExtension{
Insecure: true,
},
Archiver: InsecureExtension{
Insecure: true,
},
+16 -16
View File
@@ -109,7 +109,7 @@ func NewService(options ...Option) (*Service, error) {
s.ServicesRegistry[opts.Config.Settings.Service.Name] = settings.NewSutureService
s.ServicesRegistry[opts.Config.Nats.Service.Name] = nats.NewSutureService
s.ServicesRegistry[opts.Config.StorageMetadata.Service.Name] = storagemetadata.NewStorageMetadata
s.ServicesRegistry[opts.Config.StorageMetadata.Service.Name] = storagemetadata.NewSutureService
s.ServicesRegistry[opts.Config.GLAuth.Service.Name] = glauth.NewSutureService
s.ServicesRegistry[opts.Config.Graph.Service.Name] = graph.NewSutureService
s.ServicesRegistry[opts.Config.GraphExplorer.Service.Name] = graphExplorer.NewSutureService
@@ -119,23 +119,23 @@ func NewService(options ...Option) (*Service, error) {
s.ServicesRegistry[opts.Config.Thumbnails.Service.Name] = thumbnails.NewSutureService
s.ServicesRegistry[opts.Config.Web.Service.Name] = web.NewSutureService
s.ServicesRegistry[opts.Config.WebDAV.Service.Name] = webdav.NewSutureService
s.ServicesRegistry[opts.Config.Frontend.Service.Name] = frontend.NewFrontend
s.ServicesRegistry[opts.Config.OCDav.Service.Name] = ocdav.NewOCDav
s.ServicesRegistry[opts.Config.Gateway.Service.Name] = gateway.NewGateway
s.ServicesRegistry[opts.Config.User.Service.Name] = user.NewUserProvider
s.ServicesRegistry[opts.Config.Group.Service.Name] = group.NewGroupProvider
s.ServicesRegistry[opts.Config.AuthBasic.Service.Name] = authbasic.NewAuthBasic
s.ServicesRegistry[opts.Config.AuthBearer.Service.Name] = authbearer.NewAuthBearer
s.ServicesRegistry[opts.Config.AuthMachine.Service.Name] = authmachine.NewAuthMachine
s.ServicesRegistry[opts.Config.StorageUsers.Service.Name] = storageusers.NewStorageUsers
s.ServicesRegistry[opts.Config.StorageShares.Service.Name] = storageshares.NewStorageShares
s.ServicesRegistry[opts.Config.StoragePublicLink.Service.Name] = storagepublic.NewStoragePublicLink
s.ServicesRegistry[opts.Config.AppProvider.Service.Name] = appprovider.NewAppProvider
s.ServicesRegistry[opts.Config.Frontend.Service.Name] = frontend.NewSutureService
s.ServicesRegistry[opts.Config.OCDav.Service.Name] = ocdav.NewSutureService
s.ServicesRegistry[opts.Config.Gateway.Service.Name] = gateway.NewSutureService
s.ServicesRegistry[opts.Config.User.Service.Name] = user.NewSutureService
s.ServicesRegistry[opts.Config.Group.Service.Name] = group.NewSutureService
s.ServicesRegistry[opts.Config.AuthBasic.Service.Name] = authbasic.NewSutureService
s.ServicesRegistry[opts.Config.AuthBearer.Service.Name] = authbearer.NewSutureService
s.ServicesRegistry[opts.Config.AuthMachine.Service.Name] = authmachine.NewSutureService
s.ServicesRegistry[opts.Config.StorageUsers.Service.Name] = storageusers.NewSutureService
s.ServicesRegistry[opts.Config.StorageShares.Service.Name] = storageshares.NewSutureService
s.ServicesRegistry[opts.Config.StoragePublicLink.Service.Name] = storagepublic.NewSutureService
s.ServicesRegistry[opts.Config.AppProvider.Service.Name] = appprovider.NewSutureService
s.ServicesRegistry[opts.Config.Notifications.Service.Name] = notifications.NewSutureService
s.ServicesRegistry[opts.Config.Search.Service.Name] = search.NewSutureService
// populate delayed services
s.Delayed[opts.Config.Sharing.Service.Name] = sharing.NewSharing
s.Delayed[opts.Config.Sharing.Service.Name] = sharing.NewSutureService
s.Delayed[opts.Config.Accounts.Service.Name] = accounts.NewSutureService
s.Delayed[opts.Config.Proxy.Service.Name] = proxy.NewSutureService
s.Delayed[opts.Config.IDP.Service.Name] = idp.NewSutureService
@@ -256,7 +256,7 @@ func (s *Service) generateRunSet(cfg *ociscfg.Config) {
}
for name := range s.ServicesRegistry {
// don't run glauth by default but keep the possiblity to start it via cfg.Runtime.Extensions for now
// don't run glauth by default but keep the possibility to start it via cfg.Runtime.Extensions for now
if name == "glauth" {
continue
}
@@ -264,7 +264,7 @@ func (s *Service) generateRunSet(cfg *ociscfg.Config) {
}
for name := range s.Delayed {
// don't run accounts by default but keep the possiblity to start it via cfg.Runtime.Extensions for now
// don't run accounts by default but keep the possibility to start it via cfg.Runtime.Extensions for now
if name == "accounts" {
continue
}