Merge pull request #4019 from aduffeck/use-config-file-when-migrating

Actually use the sharing configuration from the config file
This commit is contained in:
Michael Barz authored and GitHub committed 2022-06-27 11:13:04 +02:00
commit e5b58c6b13
2 files changed
+16 -16

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
Enhancement: New migrate command for migrating shares and public shares
We added a new `migrate` subcommand which can be used to migrate shares and public shares between different share and publicshare managers.
https://github.com/owncloud/ocis/pull/3987
https://github.com/owncloud/ocis/pull/4019
+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())