Merge remote-tracking branch 'upstream/master' into search

This commit is contained in:
André Duffeck
2022-04-29 13:00:01 +02:00
130 changed files with 5205 additions and 2152 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/ocdav/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,11 +13,11 @@ func OCDavCommand(cfg *config.Config) *cli.Command {
Name: "ocdav",
Usage: "start ocdav",
Category: "extensions",
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
// Before: func(ctx *cli.Context) error {
// return ParseStorageCommon(ctx, cfg)
// },
Action: func(c *cli.Context) error {
origCmd := command.OCDav(cfg.Storage)
origCmd := command.OCDav(cfg.OCDav)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/appprovider/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-app-provider",
Usage: "start storage app-provider service",
Category: "extensions",
//Flags: flagset.AppProviderWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.AppProvider(cfg.Storage)
origCmd := command.AppProvider(cfg.AppProvider)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/auth-basic/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageAuthBasicCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-basic",
Usage: "start storage auth-basic service",
Category: "extensions",
//Flags: flagset.AuthBasicWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.AuthBasic(cfg.Storage)
origCmd := command.AuthBasic(cfg.AuthBasic)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/auth-bearer/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageAuthBearerCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-bearer",
Usage: "Start storage auth-bearer service",
Category: "extensions",
//Flags: flagset.AuthBearerWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.AuthBearer(cfg.Storage)
origCmd := command.AuthBearer(cfg.AuthBearer)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/auth-machine/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageAuthMachineCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-machine",
Usage: "start storage auth-machine service",
Category: "extensions",
//Flags: flagset.AuthMachineWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.AuthMachine(cfg.Storage)
origCmd := command.AuthMachine(cfg.AuthMachine)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/frontend/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageFrontendCommand(cfg *config.Config) *cli.Command {
Name: "storage-frontend",
Usage: "start storage frontend",
Category: "extensions",
//Flags: flagset.FrontendWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Frontend(cfg.Storage)
origCmd := command.Frontend(cfg.Frontend)
return handleOriginalAction(c, origCmd)
},
}
+5 -5
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/gateway/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -14,11 +14,11 @@ func StorageGatewayCommand(cfg *config.Config) *cli.Command {
Usage: "start storage gateway",
Category: "extensions",
//Flags: flagset.GatewayWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
// Before: func(ctx *cli.Context) error {
// return ParseStorageCommon(ctx, cfg)
// },
Action: func(c *cli.Context) error {
origCmd := command.Gateway(cfg.Storage)
origCmd := command.Gateway(cfg.Gateway)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/group/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageGroupProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-groupprovider",
Usage: "start storage groupprovider service",
Category: "extensions",
//Flags: flagset.GroupsWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Groups(cfg.Storage)
origCmd := command.Groups(cfg.Group)
return handleOriginalAction(c, origCmd)
},
}
+2 -5
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,11 +13,8 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command {
Name: "storage-metadata",
Usage: "start storage and data service for metadata",
Category: "extensions",
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.StorageMetadata(cfg.Storage)
origCmd := command.StorageMetadata(cfg.StorageMetadata)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/storage-publiclink/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
Name: "storage-public-link",
Usage: "start storage public link storage",
Category: "extensions",
//Flags: flagset.StoragePublicLink(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.StoragePublicLink(cfg.Storage)
origCmd := command.StoragePublicLink(cfg.StoragePublicLink)
return handleOriginalAction(c, origCmd)
},
}
+2 -5
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/storage-shares/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,11 +13,8 @@ func StorageSharesCommand(cfg *config.Config) *cli.Command {
Name: "storage-shares",
Usage: "start storage and data provider for shares jail",
Category: "extensions",
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.StorageShares(cfg.Storage)
origCmd := command.StorageShares(cfg.StorageShares)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/sharing/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageSharingCommand(cfg *config.Config) *cli.Command {
Name: "storage-sharing",
Usage: "start storage sharing service",
Category: "extensions",
//Flags: flagset.SharingWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Sharing(cfg.Storage)
origCmd := command.Sharing(cfg.Sharing)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/user/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -13,12 +13,8 @@ func StorageUserProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-userprovider",
Usage: "start storage userprovider service",
Category: "extensions",
//Flags: flagset.UsersWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Users(cfg.Storage)
origCmd := command.User(cfg.User)
return handleOriginalAction(c, origCmd)
},
}
+2 -6
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"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"
@@ -13,12 +13,8 @@ func StorageUsersCommand(cfg *config.Config) *cli.Command {
Name: "storage-users",
Usage: "start storage and data provider for /users mount",
Category: "extensions",
//Flags: flagset.StorageUsersWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.StorageUsers(cfg.Storage)
origCmd := command.StorageUsers(cfg.StorageUsers)
return handleOriginalAction(c, origCmd)
},
}
-27
View File
@@ -1,27 +0,0 @@
package command
import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis-pkg/shared"
"github.com/urfave/cli/v2"
)
func ParseStorageCommon(ctx *cli.Context, cfg *config.Config) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Storage.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
cfg.Storage.Log = &shared.Log{
Level: cfg.Commons.Log.Level,
Pretty: cfg.Commons.Log.Pretty,
Color: cfg.Commons.Log.Color,
File: cfg.Commons.Log.File,
}
} else if cfg.Storage.Log == nil && cfg.Commons == nil {
cfg.Storage.Log = &shared.Log{}
}
return nil
}
+38 -27
View File
@@ -20,23 +20,35 @@ import (
"github.com/olekukonko/tablewriter"
accounts "github.com/owncloud/ocis/extensions/accounts/pkg/command"
appprovider "github.com/owncloud/ocis/extensions/appprovider/pkg/command"
authbasic "github.com/owncloud/ocis/extensions/auth-basic/pkg/command"
authbearer "github.com/owncloud/ocis/extensions/auth-bearer/pkg/command"
authmachine "github.com/owncloud/ocis/extensions/auth-machine/pkg/command"
frontend "github.com/owncloud/ocis/extensions/frontend/pkg/command"
gateway "github.com/owncloud/ocis/extensions/gateway/pkg/command"
glauth "github.com/owncloud/ocis/extensions/glauth/pkg/command"
graphExplorer "github.com/owncloud/ocis/extensions/graph-explorer/pkg/command"
graph "github.com/owncloud/ocis/extensions/graph/pkg/command"
group "github.com/owncloud/ocis/extensions/group/pkg/command"
idm "github.com/owncloud/ocis/extensions/idm/pkg/command"
idp "github.com/owncloud/ocis/extensions/idp/pkg/command"
nats "github.com/owncloud/ocis/extensions/nats/pkg/command"
notifications "github.com/owncloud/ocis/extensions/notifications/pkg/command"
ocdav "github.com/owncloud/ocis/extensions/ocdav/pkg/command"
ocs "github.com/owncloud/ocis/extensions/ocs/pkg/command"
proxy "github.com/owncloud/ocis/extensions/proxy/pkg/command"
search "github.com/owncloud/ocis/extensions/search/pkg/command"
settings "github.com/owncloud/ocis/extensions/settings/pkg/command"
storage "github.com/owncloud/ocis/extensions/storage/pkg/command"
sharing "github.com/owncloud/ocis/extensions/sharing/pkg/command"
storagemetadata "github.com/owncloud/ocis/extensions/storage-metadata/pkg/command"
storagepublic "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/command"
storageshares "github.com/owncloud/ocis/extensions/storage-shares/pkg/command"
storageusers "github.com/owncloud/ocis/extensions/storage-users/pkg/command"
store "github.com/owncloud/ocis/extensions/store/pkg/command"
thumbnails "github.com/owncloud/ocis/extensions/thumbnails/pkg/command"
user "github.com/owncloud/ocis/extensions/user/pkg/command"
web "github.com/owncloud/ocis/extensions/web/pkg/command"
webdav "github.com/owncloud/ocis/extensions/webdav/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/rs/zerolog"
@@ -97,36 +109,36 @@ func NewService(options ...Option) (*Service, error) {
s.ServicesRegistry["settings"] = settings.NewSutureService
s.ServicesRegistry["nats"] = nats.NewSutureService
s.ServicesRegistry["storage-metadata"] = storage.NewStorageMetadata
s.ServicesRegistry["storage-metadata"] = storagemetadata.NewStorageMetadata
s.ServicesRegistry["glauth"] = glauth.NewSutureService
s.ServicesRegistry["graph"] = graph.NewSutureService
s.ServicesRegistry["graph-explorer"] = graphExplorer.NewSutureService
s.ServicesRegistry["idp"] = idp.NewSutureService
s.ServicesRegistry["idm"] = idm.NewSutureService
s.ServicesRegistry["ocs"] = ocs.NewSutureService
s.ServicesRegistry["store"] = store.NewSutureService
s.ServicesRegistry["thumbnails"] = thumbnails.NewSutureService
s.ServicesRegistry["web"] = web.NewSutureService
s.ServicesRegistry["webdav"] = webdav.NewSutureService
s.ServicesRegistry["storage-frontend"] = storage.NewFrontend
s.ServicesRegistry["ocdav"] = storage.NewOCDav
s.ServicesRegistry["storage-gateway"] = storage.NewGateway
s.ServicesRegistry["storage-userprovider"] = storage.NewUserProvider
s.ServicesRegistry["storage-groupprovider"] = storage.NewGroupProvider
s.ServicesRegistry["storage-authbasic"] = storage.NewAuthBasic
s.ServicesRegistry["storage-authbearer"] = storage.NewAuthBearer
s.ServicesRegistry["storage-authmachine"] = storage.NewAuthMachine
s.ServicesRegistry["storage-users"] = storage.NewStorageUsers
s.ServicesRegistry["storage-shares"] = storage.NewStorageShares
s.ServicesRegistry["storage-public-link"] = storage.NewStoragePublicLink
s.ServicesRegistry["storage-appprovider"] = storage.NewAppProvider
s.ServicesRegistry["storage-frontend"] = frontend.NewFrontend
s.ServicesRegistry["ocdav"] = ocdav.NewOCDav
s.ServicesRegistry["storage-gateway"] = gateway.NewGateway
s.ServicesRegistry["storage-userprovider"] = user.NewUserProvider
s.ServicesRegistry["storage-groupprovider"] = group.NewGroupProvider
s.ServicesRegistry["storage-authbasic"] = authbasic.NewAuthBasic
s.ServicesRegistry["storage-authbearer"] = authbearer.NewAuthBearer
s.ServicesRegistry["storage-authmachine"] = authmachine.NewAuthMachine
s.ServicesRegistry["storage-users"] = storageusers.NewStorageUsers
s.ServicesRegistry["storage-shares"] = storageshares.NewStorageShares
s.ServicesRegistry["storage-public-link"] = storagepublic.NewStoragePublicLink
s.ServicesRegistry["storage-appprovider"] = appprovider.NewAppProvider
s.ServicesRegistry["notifications"] = notifications.NewSutureService
s.ServicesRegistry["search"] = search.NewSutureService
// populate delayed services
s.Delayed["storage-sharing"] = storage.NewSharing
s.Delayed["storage-sharing"] = sharing.NewSharing
s.Delayed["accounts"] = accounts.NewSutureService
s.Delayed["proxy"] = proxy.NewSutureService
s.Delayed["idp"] = idp.NewSutureService
return s, nil
}
@@ -174,15 +186,6 @@ func Start(o ...Option) error {
}
}
if s.cfg.Storage.Log == nil {
s.cfg.Storage.Log = &shared.Log{}
}
s.cfg.Storage.Log.Color = s.cfg.Commons.Log.Color
s.cfg.Storage.Log.Level = s.cfg.Commons.Log.Level
s.cfg.Storage.Log.Pretty = s.cfg.Commons.Log.Pretty
s.cfg.Storage.Log.File = s.cfg.Commons.Log.File
if err = rpc.Register(s); err != nil {
if s != nil {
s.Log.Fatal().Err(err)
@@ -243,7 +246,7 @@ func scheduleServiceTokens(s *Service, funcSet serviceFuncMap) {
// generateRunSet interprets the cfg.Runtime.Extensions config option to cherry-pick which services to start using
// the runtime.
func (s *Service) generateRunSet(cfg *config.Config) {
func (s *Service) generateRunSet(cfg *ociscfg.Config) {
if cfg.Runtime.Extensions != "" {
e := strings.Split(strings.ReplaceAll(cfg.Runtime.Extensions, " ", ""), ",")
for i := range e {
@@ -253,10 +256,18 @@ func (s *Service) generateRunSet(cfg *config.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
if name == "glauth" {
continue
}
runset = append(runset, name)
}
for name := range s.Delayed {
// don't run accounts by default but keep the possiblity to start it via cfg.Runtime.Extensions for now
if name == "accounts" {
continue
}
runset = append(runset, name)
}
}