set all previously set on c.StringSlice values on the bootstrap config

This commit is contained in:
A.Unger
2021-11-16 12:22:17 +01:00
parent 097c853894
commit 0d7be0d6ad
26 changed files with 30 additions and 48 deletions

View File

@@ -6,7 +6,6 @@ import (
"github.com/asim/go-micro/plugins/client/grpc/v4"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/flagset"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/urfave/cli/v2"
"google.golang.org/genproto/protobuf/field_mask"
@@ -21,7 +20,7 @@ func UpdateAccount(cfg *config.Config) *cli.Command {
Name: "update",
Usage: "Make changes to an existing account",
ArgsUsage: "id",
Flags: flagset.UpdateAccountWithConfig(cfg, a),
//Flags: flagset.UpdateAccountWithConfig(cfg, a),
Before: func(c *cli.Context) error {
if len(c.StringSlice("password_policies")) > 0 {
// StringSliceFlag doesn't support Destination

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-app-provider",
Usage: "Start storage app-provider service",
Category: "Extensions",
Flags: flagset.AppProviderWithConfig(cfg.Storage),
//Flags: flagset.AppProviderWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageAuthBasicCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-basic",
Usage: "Start storage auth-basic service",
Category: "Extensions",
Flags: flagset.AuthBasicWithConfig(cfg.Storage),
//Flags: flagset.AuthBasicWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageAuthBearerCommand(cfg *config.Config) *cli.Command {
Name: "storage-auth-bearer",
Usage: "Start storage auth-bearer service",
Category: "Extensions",
Flags: flagset.AuthBearerWithConfig(cfg.Storage),
//Flags: flagset.AuthBearerWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageFrontendCommand(cfg *config.Config) *cli.Command {
Name: "storage-frontend",
Usage: "Start storage frontend",
Category: "Extensions",
Flags: flagset.FrontendWithConfig(cfg.Storage),
//Flags: flagset.FrontendWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageGatewayCommand(cfg *config.Config) *cli.Command {
Name: "storage-gateway",
Usage: "Start storage gateway",
Category: "Extensions",
Flags: flagset.GatewayWithConfig(cfg.Storage),
//Flags: flagset.GatewayWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageGroupProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-groupprovider",
Usage: "Start storage groupprovider service",
Category: "Extensions",
Flags: flagset.GroupsWithConfig(cfg.Storage),
//Flags: flagset.GroupsWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageHomeCommand(cfg *config.Config) *cli.Command {
Name: "storage-home",
Usage: "Start storage and data provider for /home mount",
Category: "Extensions",
Flags: flagset.StorageHomeWithConfig(cfg.Storage),
//Flags: flagset.StorageHomeWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -4,7 +4,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -14,7 +13,7 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command {
Name: "storage-metadata",
Usage: "Start storage and data service for metadata",
Category: "Extensions",
Flags: flagset.StorageMetadata(cfg.Storage),
//Flags: flagset.StorageMetadata(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
Name: "storage-public-link",
Usage: "Start storage public link storage",
Category: "Extensions",
Flags: flagset.StoragePublicLink(cfg.Storage),
//Flags: flagset.StoragePublicLink(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageSharingCommand(cfg *config.Config) *cli.Command {
Name: "storage-sharing",
Usage: "Start storage sharing service",
Category: "Extensions",
Flags: flagset.SharingWithConfig(cfg.Storage),
//Flags: flagset.SharingWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ func StorageUserProviderCommand(cfg *config.Config) *cli.Command {
Name: "storage-userprovider",
Usage: "Start storage userprovider service",
Category: "Extensions",
Flags: flagset.UsersWithConfig(cfg.Storage),
//Flags: flagset.UsersWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -17,7 +16,7 @@ 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),
//Flags: flagset.StorageUsersWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},

View File

@@ -25,7 +25,7 @@ func AppProvider(cfg *config.Config) *cli.Command {
Usage: "Start appprovider for providing apps",
//Flags: flagset.AppProviderWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.AppProvider.Services = c.StringSlice("service")
//cfg.Reva.AppProvider.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-app-provider")
},

View File

@@ -26,7 +26,7 @@ func AuthBasic(cfg *config.Config) *cli.Command {
Usage: "Start authprovider for basic auth",
//Flags: flagset.AuthBasicWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.AuthBasic.Services = c.StringSlice("service")
//cfg.Reva.AuthBasic.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-auth-basic")
},

View File

@@ -23,10 +23,7 @@ func AuthBearer(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "auth-bearer",
Usage: "Start authprovider for bearer auth",
//Flags: flagset.AuthBearerWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.AuthBearer.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-auth-bearer")
},
Action: func(c *cli.Context) error {

View File

@@ -23,10 +23,7 @@ func AuthMachine(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "auth-machine",
Usage: "Start authprovider for machine auth",
//Flags: flagset.AuthMachineWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.AuthMachine.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-auth-machine")
},
Action: func(c *cli.Context) error {

View File

@@ -27,10 +27,7 @@ func Frontend(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "frontend",
Usage: "Start frontend service",
//Flags: flagset.FrontendWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.Frontend.Services = c.StringSlice("service")
cfg.Reva.ChecksumSupportedTypes = c.StringSlice("checksum-supported-type")
if err := loadUserAgent(c, cfg); err != nil {
return err
}

View File

@@ -33,8 +33,8 @@ func Gateway(cfg *config.Config) *cli.Command {
Usage: "Start gateway",
//Flags: flagset.GatewayWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.Gateway.Services = c.StringSlice("service")
cfg.Reva.StorageRegistry.Rules = c.StringSlice("storage-registry-rule")
//cfg.Reva.Gateway.Services = c.StringSlice("service")
//cfg.Reva.StorageRegistry.Rules = c.StringSlice("storage-registry-rule")
if cfg.Reva.DataGateway.PublicURL == "" {
cfg.Reva.DataGateway.PublicURL = strings.TrimRight(cfg.Reva.Frontend.PublicURL, "/") + "/data"

View File

@@ -24,10 +24,7 @@ func Groups(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "groups",
Usage: "Start groups service",
//Flags: flagset.GroupsWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.Groups.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-groups")
},
Action: func(c *cli.Context) error {

View File

@@ -28,7 +28,7 @@ func Sharing(cfg *config.Config) *cli.Command {
Usage: "Start sharing service",
//Flags: flagset.SharingWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.Sharing.Services = c.StringSlice("service")
//cfg.Reva.Sharing.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-sharing")
},

View File

@@ -27,7 +27,7 @@ func StorageHome(cfg *config.Config) *cli.Command {
Usage: "Start storage-home service",
//Flags: flagset.StorageHomeWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageHome.Services = c.StringSlice("service")
//cfg.Reva.StorageHome.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-home")
},

View File

@@ -26,7 +26,7 @@ func StorageUsers(cfg *config.Config) *cli.Command {
Usage: "Start storage-users service",
//Flags: flagset.StorageUsersWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageHome.Services = c.StringSlice("service")
//cfg.Reva.StorageHome.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-userprovider")
},

View File

@@ -26,7 +26,7 @@ func Users(cfg *config.Config) *cli.Command {
Usage: "Start users service",
//Flags: flagset.UsersWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.Users.Services = c.StringSlice("service")
//cfg.Reva.Users.Services = c.StringSlice("service")
return ParseConfig(c, cfg, "storage-users")
},

View File

@@ -733,7 +733,7 @@ func DefaultConfig() *Config {
Protocol: "",
Endpoint: "",
DebugAddr: "127.0.0.1:9141",
Services: nil,
Services: []string{"datagateway", "ocdav", "ocs", "appprovider"},
Config: nil,
Context: nil,
Supervised: false,
@@ -788,6 +788,7 @@ func DefaultConfig() *Config {
Endpoint: "localhost:9144",
GRPCNetwork: "tcp",
GRPCAddr: "127.0.0.1:9144",
Services: []string{"userprovider"},
},
Driver: "ldap",
UserGroupsCacheExpiration: 5,
@@ -798,6 +799,7 @@ func DefaultConfig() *Config {
DebugAddr: "127.0.0.1:9161",
GRPCNetwork: "tcp",
GRPCAddr: "127.0.0.1:9160",
Services: []string{"groupprovider"},
},
Driver: "ldap",
GroupMembersCacheExpiration: 5,
@@ -811,16 +813,19 @@ func DefaultConfig() *Config {
GRPCNetwork: "tcp",
GRPCAddr: "127.0.0.1:9146",
DebugAddr: "127.0.0.1:9147",
Services: []string{"authprovider"},
},
AuthBearer: Port{
GRPCNetwork: "tcp",
GRPCAddr: "127.0.0.1:9148",
DebugAddr: "127.0.0.1:9149",
Services: []string{"authprovider"},
},
AuthMachine: Port{
GRPCNetwork: "tcp",
GRPCAddr: "127.0.0.1:9166",
DebugAddr: "127.0.0.1:9167",
Services: []string{"authprovider"},
},
AuthMachineConfig: AuthMachineConfig{
MachineAuthAPIKey: "change-me-please",
@@ -831,6 +836,7 @@ func DefaultConfig() *Config {
DebugAddr: "127.0.0.1:9151",
GRPCNetwork: "tcp",
GRPCAddr: "127.0.0.1:9150",
Services: []string{"usershareprovider", "publicshareprovider"},
},
UserDriver: "json",
UserJSONFile: path.Join(defaults.BaseDataPath(), "storage", "shares.json"),
@@ -912,6 +918,7 @@ func DefaultConfig() *Config {
GRPCAddr: "127.0.0.1:9164",
DebugAddr: "127.0.0.1:9165",
Endpoint: "localhost:9164",
Services: []string{"appprovider"},
},
ExternalAddr: "127.0.0.1:9164",
WopiDriver: WopiDriver{},

View File

@@ -52,7 +52,7 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("usershareprovider", "publicshareprovider"), // TODO osmshareprovider
Value: cli.NewStringSlice("usershareprovider", "publicshareprovider"), // accounted for
Usage: "--service usershareprovider [--service publicshareprovider]",
EnvVars: []string{"STORAGE_SHARING_SERVICES"},
},