Merge pull request #3642 from wkloucek/fix-config-parsing-unsupervised

fix ocis config parsing for subcommands
This commit is contained in:
Willy Kloucek
2022-05-02 14:35:35 +02:00
committed by GitHub
29 changed files with 223 additions and 71 deletions
+5 -4
View File
@@ -16,12 +16,13 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
Name: cfg.Accounts.Service.Name, Name: cfg.Accounts.Service.Name,
Usage: subcommandDescription(cfg.Accounts.Service.Name), Usage: subcommandDescription(cfg.Accounts.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Accounts.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Accounts), Subcommands: command.GetCommands(cfg.Accounts),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func AuditCommand(cfg *config.Config) *cli.Command {
Name: "audit", Name: "audit",
Usage: "start audit service", Usage: "start audit service",
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Audit.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Audit), Subcommands: command.GetCommands(cfg.Audit),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func GLAuthCommand(cfg *config.Config) *cli.Command {
Name: cfg.GLAuth.Service.Name, Name: cfg.GLAuth.Service.Name,
Usage: subcommandDescription(cfg.GLAuth.Service.Name), Usage: subcommandDescription(cfg.GLAuth.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.GLAuth.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.GLAuth), Subcommands: command.GetCommands(cfg.GLAuth),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func GraphCommand(cfg *config.Config) *cli.Command {
Name: cfg.Graph.Service.Name, Name: cfg.Graph.Service.Name,
Usage: subcommandDescription(cfg.Graph.Service.Name), Usage: subcommandDescription(cfg.Graph.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Graph.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Graph), Subcommands: command.GetCommands(cfg.Graph),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command {
Name: cfg.GraphExplorer.Service.Name, Name: cfg.GraphExplorer.Service.Name,
Usage: subcommandDescription(cfg.GraphExplorer.Service.Name), Usage: subcommandDescription(cfg.GraphExplorer.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.GraphExplorer.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.GraphExplorer), Subcommands: command.GetCommands(cfg.GraphExplorer),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func IDMCommand(cfg *config.Config) *cli.Command {
Name: "idm", Name: "idm",
Usage: "idm extension commands", Usage: "idm extension commands",
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.IDM.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.IDM), Subcommands: command.GetCommands(cfg.IDM),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func IDPCommand(cfg *config.Config) *cli.Command {
Name: cfg.IDP.Service.Name, Name: cfg.IDP.Service.Name,
Usage: subcommandDescription(cfg.IDP.Service.Name), Usage: subcommandDescription(cfg.IDP.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.IDP.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.IDP), Subcommands: command.GetCommands(cfg.IDP),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func NatsServerCommand(cfg *config.Config) *cli.Command {
Name: "nats-server", Name: "nats-server",
Usage: "start nats server", Usage: "start nats server",
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Nats.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Nats), Subcommands: command.GetCommands(cfg.Nats),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func NotificationsCommand(cfg *config.Config) *cli.Command {
Name: "notifications", Name: "notifications",
Usage: "start notifications service", Usage: "start notifications service",
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Notifications.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Notifications), Subcommands: command.GetCommands(cfg.Notifications),
} }
+11 -3
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/ocdav/pkg/command" "github.com/owncloud/ocis/extensions/ocdav/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,9 +16,14 @@ func OCDavCommand(cfg *config.Config) *cli.Command {
Name: "ocdav", Name: "ocdav",
Usage: "start ocdav", Usage: "start ocdav",
Category: "extensions", Category: "extensions",
// Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
// return ParseStorageCommon(ctx, cfg) if err := parser.ParseConfig(cfg); err != nil {
// }, fmt.Printf("%v", err)
return err
}
cfg.OCDav.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.OCDav(cfg.OCDav) origCmd := command.OCDav(cfg.OCDav)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+5 -4
View File
@@ -16,12 +16,13 @@ func OCSCommand(cfg *config.Config) *cli.Command {
Name: cfg.OCS.Service.Name, Name: cfg.OCS.Service.Name,
Usage: subcommandDescription(cfg.OCS.Service.Name), Usage: subcommandDescription(cfg.OCS.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.OCS.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.OCS), Subcommands: command.GetCommands(cfg.OCS),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
Name: cfg.Proxy.Service.Name, Name: cfg.Proxy.Service.Name,
Usage: subcommandDescription(cfg.Proxy.Service.Name), Usage: subcommandDescription(cfg.Proxy.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Proxy.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Proxy), Subcommands: command.GetCommands(cfg.Proxy),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func SettingsCommand(cfg *config.Config) *cli.Command {
Name: cfg.Settings.Service.Name, Name: cfg.Settings.Service.Name,
Usage: subcommandDescription(cfg.Settings.Service.Name), Usage: subcommandDescription(cfg.Settings.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Settings.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Settings), Subcommands: command.GetCommands(cfg.Settings),
} }
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/appprovider/pkg/command" "github.com/owncloud/ocis/extensions/appprovider/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-app-provider", Name: "storage-app-provider",
Usage: "start storage app-provider service", Usage: "start storage app-provider service",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.AppProvider.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.AppProvider(cfg.AppProvider) origCmd := command.AppProvider(cfg.AppProvider)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/auth-basic/pkg/command" "github.com/owncloud/ocis/extensions/auth-basic/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageAuthBasicCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-basic", Name: "storage-auth-basic",
Usage: "start storage auth-basic service", Usage: "start storage auth-basic service",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.AuthBasic.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.AuthBasic(cfg.AuthBasic) origCmd := command.AuthBasic(cfg.AuthBasic)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/auth-bearer/pkg/command" "github.com/owncloud/ocis/extensions/auth-bearer/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageAuthBearerCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-bearer", Name: "storage-auth-bearer",
Usage: "Start storage auth-bearer service", Usage: "Start storage auth-bearer service",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.AuthBearer.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.AuthBearer(cfg.AuthBearer) origCmd := command.AuthBearer(cfg.AuthBearer)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/auth-machine/pkg/command" "github.com/owncloud/ocis/extensions/auth-machine/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageAuthMachineCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-machine", Name: "storage-auth-machine",
Usage: "start storage auth-machine service", Usage: "start storage auth-machine service",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.AuthMachine.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.AuthMachine(cfg.AuthMachine) origCmd := command.AuthMachine(cfg.AuthMachine)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/frontend/pkg/command" "github.com/owncloud/ocis/extensions/frontend/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageFrontendCommand(cfg *config.Config) *cli.Command {
Name: "storage-frontend", Name: "storage-frontend",
Usage: "start storage frontend", Usage: "start storage frontend",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.Frontend.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.Frontend(cfg.Frontend) origCmd := command.Frontend(cfg.Frontend)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11 -4
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/gateway/pkg/command" "github.com/owncloud/ocis/extensions/gateway/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,10 +16,14 @@ func StorageGatewayCommand(cfg *config.Config) *cli.Command {
Name: "storage-gateway", Name: "storage-gateway",
Usage: "start storage gateway", Usage: "start storage gateway",
Category: "extensions", Category: "extensions",
//Flags: flagset.GatewayWithConfig(cfg.Storage), Before: func(c *cli.Context) error {
// Before: func(ctx *cli.Context) error { if err := parser.ParseConfig(cfg); err != nil {
// return ParseStorageCommon(ctx, cfg) fmt.Printf("%v", err)
// }, return err
}
cfg.Gateway.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.Gateway(cfg.Gateway) origCmd := command.Gateway(cfg.Gateway)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/group/pkg/command" "github.com/owncloud/ocis/extensions/group/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageGroupProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-groupprovider", Name: "storage-groupprovider",
Usage: "start storage groupprovider service", Usage: "start storage groupprovider service",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.Group.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.Groups(cfg.Group) origCmd := command.Groups(cfg.Group)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/storage-metadata/pkg/command" "github.com/owncloud/ocis/extensions/storage-metadata/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command {
Name: "storage-metadata", Name: "storage-metadata",
Usage: "start storage and data service for metadata", Usage: "start storage and data service for metadata",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.StorageMetadata.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.StorageMetadata(cfg.StorageMetadata) origCmd := command.StorageMetadata(cfg.StorageMetadata)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/storage-publiclink/pkg/command" "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
Name: "storage-public-link", Name: "storage-public-link",
Usage: "start storage public link storage", Usage: "start storage public link storage",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.StoragePublicLink.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.StoragePublicLink(cfg.StoragePublicLink) origCmd := command.StoragePublicLink(cfg.StoragePublicLink)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/storage-shares/pkg/command" "github.com/owncloud/ocis/extensions/storage-shares/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageSharesCommand(cfg *config.Config) *cli.Command {
Name: "storage-shares", Name: "storage-shares",
Usage: "start storage and data provider for shares jail", Usage: "start storage and data provider for shares jail",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.StorageShares.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.StorageShares(cfg.StorageShares) origCmd := command.StorageShares(cfg.StorageShares)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/sharing/pkg/command" "github.com/owncloud/ocis/extensions/sharing/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageSharingCommand(cfg *config.Config) *cli.Command {
Name: "storage-sharing", Name: "storage-sharing",
Usage: "start storage sharing service", Usage: "start storage sharing service",
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
fmt.Printf("%v", err)
return err
}
cfg.Sharing.Commons = cfg.Commons
return nil
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.Sharing(cfg.Sharing) origCmd := command.Sharing(cfg.Sharing)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+11
View File
@@ -1,8 +1,11 @@
package command package command
import ( import (
"fmt"
"github.com/owncloud/ocis/extensions/user/pkg/command" "github.com/owncloud/ocis/extensions/user/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config" "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register" "github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@@ -13,6 +16,14 @@ func StorageUserProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-userprovider", Name: "storage-userprovider",
Usage: "start storage userprovider service", Usage: "start storage userprovider service",
Category: "extensions", 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
},
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
origCmd := command.User(cfg.User) origCmd := command.User(cfg.User)
return handleOriginalAction(c, origCmd) return handleOriginalAction(c, origCmd)
+5 -4
View File
@@ -17,12 +17,13 @@ func StoreCommand(cfg *config.Config) *cli.Command {
Name: cfg.Store.Service.Name, Name: cfg.Store.Service.Name,
Usage: subcommandDescription(cfg.Store.Service.Name), Usage: subcommandDescription(cfg.Store.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Store.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Store), Subcommands: command.GetCommands(cfg.Store),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command {
Name: cfg.Thumbnails.Service.Name, Name: cfg.Thumbnails.Service.Name,
Usage: subcommandDescription(cfg.Thumbnails.Service.Name), Usage: subcommandDescription(cfg.Thumbnails.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Thumbnails.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Thumbnails), Subcommands: command.GetCommands(cfg.Thumbnails),
} }
+5 -4
View File
@@ -16,12 +16,13 @@ func WebCommand(cfg *config.Config) *cli.Command {
Name: cfg.Web.Service.Name, Name: cfg.Web.Service.Name,
Usage: subcommandDescription(cfg.Web.Service.Name), Usage: subcommandDescription(cfg.Web.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.Web.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.Web), Subcommands: command.GetCommands(cfg.Web),
} }
+5 -4
View File
@@ -17,12 +17,13 @@ func WebDAVCommand(cfg *config.Config) *cli.Command {
Name: cfg.WebDAV.Service.Name, Name: cfg.WebDAV.Service.Name,
Usage: subcommandDescription(cfg.WebDAV.Service.Name), Usage: subcommandDescription(cfg.WebDAV.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(ctx *cli.Context) error { Before: func(c *cli.Context) error {
err := parser.ParseConfig(cfg) if err := parser.ParseConfig(cfg); err != nil {
if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err
} }
return err cfg.WebDAV.Commons = cfg.Commons
return nil
}, },
Subcommands: command.GetCommands(cfg.WebDAV), Subcommands: command.GetCommands(cfg.WebDAV),
} }