Actually use the sharing configuraion from the config file

This commit is contained in:
André Duffeck
2022-06-23 11:08:40 +02:00
parent 317eb807da
commit f290330dbc
+10 -16
View File
@@ -12,8 +12,10 @@ import (
"github.com/cs3org/reva/v2/pkg/share"
"github.com/cs3org/reva/v2/pkg/share/manager/registry"
sharing "github.com/owncloud/ocis/v2/extensions/sharing/pkg/config"
sharingparser "github.com/owncloud/ocis/v2/extensions/sharing/pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis-pkg/config"
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
"github.com/owncloud/ocis/v2/ocis/pkg/register"
"github.com/rs/zerolog"
"github.com/urfave/cli/v2"
@@ -26,10 +28,18 @@ func Migrate(cfg *config.Config) *cli.Command {
Usage: "migrate data from an existing to another instance",
Category: "migration",
Before: func(c *cli.Context) error {
// Parse base config
if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err)
return err
}
// Parse sharing config
cfg.Sharing.Commons = cfg.Commons
if err := sharingparser.ParseConfig(cfg.Sharing); err != nil {
fmt.Printf("%v", err)
return err
}
return nil
},
Subcommands: []*cli.Command{
@@ -59,14 +69,6 @@ func MigrateShares(cfg *config.Config) *cli.Command {
Usage: "Share manager to import the data into",
},
},
Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg, true)
if err != nil {
fmt.Printf("%v", err)
os.Exit(1)
}
return nil
},
Action: func(c *cli.Context) error {
log := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger()
ctx := log.WithContext(context.Background())
@@ -152,14 +154,6 @@ func MigratePublicShares(cfg *config.Config) *cli.Command {
Usage: "Public share manager to import the data into",
},
},
Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg, true)
if err != nil {
fmt.Printf("%v", err)
os.Exit(1)
}
return err
},
Action: func(c *cli.Context) error {
log := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger()
ctx := log.WithContext(context.Background())