Merge branch 'master' into autoincrement-index

This commit is contained in:
A.Unger
2020-10-22 11:34:04 +02:00
56 changed files with 674 additions and 2386 deletions
+4 -4
View File
@@ -73,18 +73,18 @@ func AuthBasic(cfg *config.Config) *cli.Command {
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
"max_cpus": cfg.Reva.AuthBasic.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "auth-basic",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.AuthBasic.Network,
"address": cfg.Reva.AuthBasic.Addr,
"network": cfg.Reva.AuthBasic.GRPCNetwork,
"address": cfg.Reva.AuthBasic.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"authprovider": map[string]interface{}{
+4 -4
View File
@@ -73,18 +73,18 @@ func AuthBearer(cfg *config.Config) *cli.Command {
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
"max_cpus": cfg.Reva.AuthBearer.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "auth-bearer",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.AuthBearer.Network,
"address": cfg.Reva.AuthBearer.Addr,
"network": cfg.Reva.AuthBearer.GRPCNetwork,
"address": cfg.Reva.AuthBearer.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"authprovider": map[string]interface{}{
+2 -1
View File
@@ -83,7 +83,7 @@ func drivers(cfg *config.Config) map[string]interface{} {
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"userprovidersvc": cfg.Reva.Users.URL,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"ocis": map[string]interface{}{
"root": cfg.Reva.Storages.Common.Root,
@@ -91,6 +91,7 @@ func drivers(cfg *config.Config) map[string]interface{} {
"user_layout": cfg.Reva.Storages.Common.UserLayout,
"treetime_accounting": true,
"treesize_accounting": true,
"owner": "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad", // the accounts service system account uuid
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
+5 -16
View File
@@ -6,7 +6,6 @@ import (
"os"
"os/signal"
"path"
"strings"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
@@ -103,15 +102,15 @@ func Frontend(cfg *config.Config) *cli.Command {
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "frontend",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.URL, // Todo or address?
"gatewaysvc": cfg.Reva.Gateway.Endpoint, // Todo or address?
},
"http": map[string]interface{}{
"network": cfg.Reva.Frontend.Network,
"address": cfg.Reva.Frontend.Addr,
"network": cfg.Reva.Frontend.HTTPNetwork,
"address": cfg.Reva.Frontend.HTTPAddr,
"middlewares": map[string]interface{}{
"cors": map[string]interface{}{
"allow_credentials": true,
@@ -139,7 +138,7 @@ func Frontend(cfg *config.Config) *cli.Command {
"config": map[string]interface{}{
"version": "1.8",
"website": "reva",
"host": urlWithScheme(cfg.Reva.Frontend.URL),
"host": cfg.Reva.Frontend.PublicURL,
"contact": "admin@localhost",
"ssl": "false",
},
@@ -298,13 +297,3 @@ func Frontend(cfg *config.Config) *cli.Command {
},
}
}
// urlWithScheme checks if the given string is prefixed with "http". If it is not, "http://" will be added as prefix.
// As we can't tell if http or https should be the preferred scheme, the correct approach would be to fail on urls
// without scheme. As long as we have default urls in our flagsets which don't have a scheme, this is a feasible workaround.
func urlWithScheme(str string) string {
if !strings.HasPrefix(str, "http") {
str = "http://" + str
}
return str
}
+23 -32
View File
@@ -80,35 +80,35 @@ func Gateway(cfg *config.Config) *cli.Command {
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "gateway",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.URL, // Todo or address?
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.Gateway.Network,
"address": cfg.Reva.Gateway.Addr,
"network": cfg.Reva.Gateway.GRPCNetwork,
"address": cfg.Reva.Gateway.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"gateway": map[string]interface{}{
// registries is located on the gateway
"authregistrysvc": cfg.Reva.Gateway.URL,
"storageregistrysvc": cfg.Reva.Gateway.URL,
"appregistrysvc": cfg.Reva.Gateway.URL,
"authregistrysvc": cfg.Reva.Gateway.Endpoint,
"storageregistrysvc": cfg.Reva.Gateway.Endpoint,
"appregistrysvc": cfg.Reva.Gateway.Endpoint,
// user metadata is located on the users services
"preferencessvc": cfg.Reva.Users.URL,
"userprovidersvc": cfg.Reva.Users.URL,
"preferencessvc": cfg.Reva.Users.Endpoint,
"userprovidersvc": cfg.Reva.Users.Endpoint,
// sharing is located on the sharing service
"usershareprovidersvc": cfg.Reva.Sharing.URL,
"publicshareprovidersvc": cfg.Reva.Sharing.URL,
"ocmshareprovidersvc": cfg.Reva.Sharing.URL,
"usershareprovidersvc": cfg.Reva.Sharing.Endpoint,
"publicshareprovidersvc": cfg.Reva.Sharing.Endpoint,
"ocmshareprovidersvc": cfg.Reva.Sharing.Endpoint,
"commit_share_to_storage_grant": cfg.Reva.Gateway.CommitShareToStorageGrant,
"commit_share_to_storage_ref": cfg.Reva.Gateway.CommitShareToStorageRef,
"share_folder": cfg.Reva.Gateway.ShareFolder, // ShareFolder is the location where to create shares in the recipient's storage provider.
// other
"disable_home_creation_on_login": cfg.Reva.Gateway.DisableHomeCreationOnLogin,
"datagateway": urlWithScheme(cfg.Reva.DataGateway.URL),
"datagateway": cfg.Reva.DataGateway.PublicURL,
"transfer_shared_secret": cfg.Reva.TransferSecret,
"transfer_expires": cfg.Reva.TransferExpires,
},
@@ -117,9 +117,9 @@ func Gateway(cfg *config.Config) *cli.Command {
"drivers": map[string]interface{}{
"static": map[string]interface{}{
"rules": map[string]interface{}{
"basic": cfg.Reva.AuthBasic.URL,
"bearer": cfg.Reva.AuthBearer.URL,
"publicshares": cfg.Reva.StoragePublicLink.URL,
"basic": cfg.Reva.AuthBasic.Endpoint,
"bearer": cfg.Reva.AuthBearer.Endpoint,
"publicshares": cfg.Reva.StoragePublicLink.Endpoint,
},
},
},
@@ -142,7 +142,7 @@ func Gateway(cfg *config.Config) *cli.Command {
ctx,
"com.owncloud.storage",
uuid.String(),
cfg.Reva.Gateway.Addr,
cfg.Reva.Gateway.GRPCAddr,
logger,
)
@@ -239,21 +239,12 @@ func rules(cfg *config.Config) map[string]interface{} {
// generate rules based on default config
return map[string]interface{}{
cfg.Reva.StorageRoot.MountPath: cfg.Reva.StorageRoot.URL,
cfg.Reva.StorageRoot.MountID: cfg.Reva.StorageRoot.URL,
cfg.Reva.StorageHome.MountPath: cfg.Reva.StorageHome.URL,
cfg.Reva.StorageHome.MountID: cfg.Reva.StorageHome.URL,
cfg.Reva.StorageEOS.MountPath: cfg.Reva.StorageEOS.URL,
cfg.Reva.StorageEOS.MountID: cfg.Reva.StorageEOS.URL,
cfg.Reva.StorageOC.MountPath: cfg.Reva.StorageOC.URL,
cfg.Reva.StorageOC.MountID: cfg.Reva.StorageOC.URL,
cfg.Reva.StorageS3.MountPath: cfg.Reva.StorageS3.URL,
cfg.Reva.StorageS3.MountID: cfg.Reva.StorageS3.URL,
cfg.Reva.StorageWND.MountPath: cfg.Reva.StorageWND.URL,
cfg.Reva.StorageWND.MountID: cfg.Reva.StorageWND.URL,
cfg.Reva.StorageCustom.MountPath: cfg.Reva.StorageCustom.URL,
cfg.Reva.StorageCustom.MountID: cfg.Reva.StorageCustom.URL,
cfg.Reva.StoragePublicLink.MountPath: cfg.Reva.StoragePublicLink.URL,
cfg.Reva.StorageHome.MountPath: cfg.Reva.StorageHome.Endpoint,
cfg.Reva.StorageHome.MountID: cfg.Reva.StorageHome.Endpoint,
cfg.Reva.StorageUsers.MountPath: cfg.Reva.StorageUsers.Endpoint,
cfg.Reva.StorageUsers.MountID: cfg.Reva.StorageUsers.Endpoint,
cfg.Reva.StoragePublicLink.MountPath: cfg.Reva.StoragePublicLink.Endpoint,
// public link storage returns the mount id of the actual storage
// medatada storage not part of the global namespace
}
}
+1 -6
View File
@@ -80,15 +80,10 @@ func Execute() error {
AuthBasic(cfg),
AuthBearer(cfg),
Sharing(cfg),
StorageRoot(cfg),
StorageHome(cfg),
StorageHomeData(cfg),
StorageUsers(cfg),
StoragePublicLink(cfg),
StorageOC(cfg),
StorageMetadata(cfg),
StorageOCData(cfg),
StorageEOS(cfg),
StorageEOSData(cfg),
Health(cfg),
},
}
+4 -4
View File
@@ -73,18 +73,18 @@ func Sharing(cfg *config.Config) *cli.Command {
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
"max_cpus": cfg.Reva.Sharing.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "sharing",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.Sharing.Network,
"address": cfg.Reva.Sharing.Addr,
"network": cfg.Reva.Sharing.GRPCNetwork,
"address": cfg.Reva.Sharing.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"usershareprovider": map[string]interface{}{
-175
View File
@@ -1,175 +0,0 @@
package command
import (
"context"
"os"
"os/signal"
"path"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
)
// StorageEOS is the entrypoint for the storage-eos command.
func StorageEOS(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-eos",
Usage: "Start storage-eos service",
Flags: flagset.StorageEOSWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageEOS.Services = c.StringSlice("service")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
if cfg.Tracing.Enabled {
switch t := cfg.Tracing.Type; t {
case "agent":
logger.Error().
Str("type", t).
Msg("Storage only supports the jaeger tracing backend")
case "jaeger":
logger.Info().
Str("type", t).
Msg("configuring storage to use the jaeger tracing backend")
case "zipkin":
logger.Error().
Str("type", t).
Msg("Storage only supports the jaeger tracing backend")
default:
logger.Warn().
Str("type", t).
Msg("Unknown tracing backend")
}
} else {
logger.Debug().
Msg("Tracing is not enabled")
}
var (
gr = run.Group{}
ctx, cancel = context.WithCancel(context.Background())
//metrics = metrics.New()
)
defer cancel()
{
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.StorageEOS.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-eos",
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageEOS.Network,
"address": cfg.Reva.StorageEOS.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageEOS.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageEOS.MountPath,
"mount_id": cfg.Reva.StorageEOS.MountID,
"expose_data_server": cfg.Reva.StorageEOS.ExposeDataServer,
// TODO use cfg.Reva.SStorageEOSData.URL, ?
"data_server_url": cfg.Reva.StorageEOS.DataServerURL,
},
},
},
}
gr.Add(func() error {
runtime.RunWithOptions(
rcfg,
pidFile,
runtime.WithLogger(&logger.Logger),
)
return nil
}, func(_ error) {
logger.Info().
Str("server", c.Command.Name).
Msg("Shutting down server")
cancel()
})
}
{
server, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageEOS.DebugAddr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
)
if err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.ListenAndServe()
}, func(_ error) {
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
defer timeout()
defer cancel()
if err := server.Shutdown(ctx); err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to shutdown server")
} else {
logger.Info().
Str("server", c.Command.Name+"-debug").
Msg("Shutting down server")
}
})
}
{
stop := make(chan os.Signal, 1)
gr.Add(func() error {
signal.Notify(stop, os.Interrupt)
<-stop
return nil
}, func(err error) {
close(stop)
cancel()
})
}
return gr.Run()
},
}
}
-175
View File
@@ -1,175 +0,0 @@
package command
import (
"context"
"os"
"os/signal"
"path"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
)
// StorageEOSData is the entrypoint for the storage-oc-data command.
func StorageEOSData(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-eos-data",
Usage: "Start storage-eos-data service",
Flags: flagset.StorageEOSDataWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageEOSData.Services = c.StringSlice("service")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
if cfg.Tracing.Enabled {
switch t := cfg.Tracing.Type; t {
case "agent":
logger.Error().
Str("type", t).
Msg("Reva only supports the jaeger tracing backend")
case "jaeger":
logger.Info().
Str("type", t).
Msg("configuring storage to use the jaeger tracing backend")
case "zipkin":
logger.Error().
Str("type", t).
Msg("Reva only supports the jaeger tracing backend")
default:
logger.Warn().
Str("type", t).
Msg("Unknown tracing backend")
}
} else {
logger.Debug().
Msg("Tracing is not enabled")
}
var (
gr = run.Group{}
ctx, cancel = context.WithCancel(context.Background())
//metrics = metrics.New()
)
defer cancel()
{
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.StorageEOSData.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-eos-data",
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.URL, // Todo or address?
},
"http": map[string]interface{}{
"network": cfg.Reva.StorageEOSData.Network,
"address": cfg.Reva.StorageEOSData.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageEOSData.Prefix,
"driver": cfg.Reva.StorageEOSData.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,
},
},
},
}
gr.Add(func() error {
runtime.RunWithOptions(
rcfg,
pidFile,
runtime.WithLogger(&logger.Logger),
)
return nil
}, func(_ error) {
logger.Info().
Str("server", c.Command.Name).
Msg("Shutting down server")
cancel()
})
}
{
server, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageEOSData.DebugAddr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
)
if err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.ListenAndServe()
}, func(_ error) {
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
defer timeout()
defer cancel()
if err := server.Shutdown(ctx); err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to shutdown server")
} else {
logger.Info().
Str("server", c.Command.Name+"-debug").
Msg("Shutting down server")
}
})
}
{
stop := make(chan os.Signal, 1)
gr.Add(func() error {
signal.Notify(stop, os.Interrupt)
<-stop
return nil
}, func(err error) {
close(stop)
cancel()
})
}
return gr.Run()
},
}
}
+21 -6
View File
@@ -80,18 +80,19 @@ func StorageHome(cfg *config.Config) *cli.Command {
}
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
"max_cpus": cfg.Reva.StorageHome.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-home",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageHome.Network,
"address": cfg.Reva.StorageHome.Addr,
"network": cfg.Reva.StorageHome.GRPCNetwork,
"address": cfg.Reva.StorageHome.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
@@ -100,8 +101,22 @@ func StorageHome(cfg *config.Config) *cli.Command {
"mount_path": cfg.Reva.StorageHome.MountPath,
"mount_id": cfg.Reva.StorageHome.MountID,
"expose_data_server": cfg.Reva.StorageHome.ExposeDataServer,
// TODO use cfg.Reva.StorageHomeData.URL, ?
"data_server_url": cfg.Reva.StorageHome.DataServerURL,
"data_server_url": cfg.Reva.StorageHome.DataServerURL,
},
},
},
"http": map[string]interface{}{
"network": cfg.Reva.StorageHome.HTTPNetwork,
"address": cfg.Reva.StorageHome.HTTPAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageHome.HTTPPrefix,
"driver": cfg.Reva.StorageHome.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,
},
},
},
+10 -9
View File
@@ -89,38 +89,39 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": "100",
"tracing_enabled": false,
"max_cpus": cfg.Reva.StorageMetadata.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-metadata",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageMetadata.Network,
"address": cfg.Reva.StorageMetadata.Addr,
"network": cfg.Reva.StorageMetadata.GRPCNetwork,
"address": cfg.Reva.StorageMetadata.GRPCAddr,
"interceptors": map[string]interface{}{
"log": map[string]interface{}{},
},
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"mount_path": "/meta",
"data_server_url": cfg.Reva.StorageMetadataData.URL,
"driver": cfg.Reva.StorageMetadata.Driver,
"drivers": drivers(cfg),
"data_server_url": cfg.Reva.StorageMetadata.DataServerURL,
},
},
},
"http": map[string]interface{}{
"network": cfg.Reva.StorageMetadataData.Network,
"address": cfg.Reva.StorageMetadataData.Addr,
"network": cfg.Reva.StorageMetadata.HTTPNetwork,
"address": cfg.Reva.StorageMetadata.HTTPAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": "data",
"driver": cfg.Reva.StorageMetadataData.Driver,
"driver": cfg.Reva.StorageMetadata.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
-175
View File
@@ -1,175 +0,0 @@
package command
import (
"context"
"os"
"os/signal"
"path"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
)
// StorageOC is the entrypoint for the storage-oc command.
func StorageOC(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-oc",
Usage: "Start storage-oc service",
Flags: flagset.StorageOCWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageOC.Services = c.StringSlice("service")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
if cfg.Tracing.Enabled {
switch t := cfg.Tracing.Type; t {
case "agent":
logger.Error().
Str("type", t).
Msg("Reva only supports the jaeger tracing backend")
case "jaeger":
logger.Info().
Str("type", t).
Msg("configuring storage to use the jaeger tracing backend")
case "zipkin":
logger.Error().
Str("type", t).
Msg("Reva only supports the jaeger tracing backend")
default:
logger.Warn().
Str("type", t).
Msg("Unknown tracing backend")
}
} else {
logger.Debug().
Msg("Tracing is not enabled")
}
var (
gr = run.Group{}
ctx, cancel = context.WithCancel(context.Background())
//metrics = metrics.New()
)
defer cancel()
{
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.StorageOC.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-oc",
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageOC.Network,
"address": cfg.Reva.StorageOC.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageOC.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageOC.MountPath,
"mount_id": cfg.Reva.StorageOC.MountID,
"expose_data_server": cfg.Reva.StorageOC.ExposeDataServer,
// TODO use cfg.Reva.SStorageOCData.URL, ?
"data_server_url": cfg.Reva.StorageOC.DataServerURL,
},
},
},
}
gr.Add(func() error {
runtime.RunWithOptions(
rcfg,
pidFile,
runtime.WithLogger(&logger.Logger),
)
return nil
}, func(_ error) {
logger.Info().
Str("server", c.Command.Name).
Msg("Shutting down server")
cancel()
})
}
{
server, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageOC.DebugAddr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
)
if err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.ListenAndServe()
}, func(_ error) {
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
defer timeout()
defer cancel()
if err := server.Shutdown(ctx); err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to shutdown server")
} else {
logger.Info().
Str("server", c.Command.Name+"-debug").
Msg("Shutting down server")
}
})
}
{
stop := make(chan os.Signal, 1)
gr.Add(func() error {
signal.Notify(stop, os.Interrupt)
<-stop
return nil
}, func(err error) {
close(stop)
cancel()
})
}
return gr.Run()
},
}
}
-175
View File
@@ -1,175 +0,0 @@
package command
import (
"context"
"os"
"os/signal"
"path"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
)
// StorageOCData is the entrypoint for the storage-oc-data command.
func StorageOCData(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-oc-data",
Usage: "Start storage-oc-data service",
Flags: flagset.StorageOCDataWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageOCData.Services = c.StringSlice("service")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
if cfg.Tracing.Enabled {
switch t := cfg.Tracing.Type; t {
case "agent":
logger.Error().
Str("type", t).
Msg("Reva only supports the jaeger tracing backend")
case "jaeger":
logger.Info().
Str("type", t).
Msg("configuring storage to use the jaeger tracing backend")
case "zipkin":
logger.Error().
Str("type", t).
Msg("Reva only supports the jaeger tracing backend")
default:
logger.Warn().
Str("type", t).
Msg("Unknown tracing backend")
}
} else {
logger.Debug().
Msg("Tracing is not enabled")
}
var (
gr = run.Group{}
ctx, cancel = context.WithCancel(context.Background())
//metrics = metrics.New()
)
defer cancel()
{
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.StorageOCData.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-oc-data",
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.URL, // Todo or address?
},
"http": map[string]interface{}{
"network": cfg.Reva.StorageOCData.Network,
"address": cfg.Reva.StorageOCData.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageOCData.Prefix,
"driver": cfg.Reva.StorageOCData.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,
},
},
},
}
gr.Add(func() error {
runtime.RunWithOptions(
rcfg,
pidFile,
runtime.WithLogger(&logger.Logger),
)
return nil
}, func(_ error) {
logger.Info().
Str("server", c.Command.Name).
Msg("Shutting down server")
cancel()
})
}
{
server, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageOCData.DebugAddr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
)
if err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.ListenAndServe()
}, func(_ error) {
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
defer timeout()
defer cancel()
if err := server.Shutdown(ctx); err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to shutdown server")
} else {
logger.Info().
Str("server", c.Command.Name+"-debug").
Msg("Shutting down server")
}
})
}
{
stop := make(chan os.Signal, 1)
gr.Add(func() error {
signal.Notify(stop, os.Interrupt)
<-stop
return nil
}, func(err error) {
close(stop)
cancel()
})
}
return gr.Run()
},
}
}
+6 -5
View File
@@ -72,27 +72,28 @@ func StoragePublicLink(cfg *config.Config) *cli.Command {
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-public-link",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StoragePublicLink.Network,
"address": cfg.Reva.StoragePublicLink.Addr,
"network": cfg.Reva.StoragePublicLink.GRPCNetwork,
"address": cfg.Reva.StoragePublicLink.GRPCAddr,
"interceptors": map[string]interface{}{
"log": map[string]interface{}{},
},
"services": map[string]interface{}{
"publicstorageprovider": map[string]interface{}{
"mount_path": cfg.Reva.StoragePublicLink.MountPath,
"gateway_addr": cfg.Reva.Gateway.URL,
"gateway_addr": cfg.Reva.Gateway.Endpoint,
},
"authprovider": map[string]interface{}{
"auth_manager": "publicshares",
"auth_managers": map[string]interface{}{
"publicshares": map[string]interface{}{
"gateway_addr": cfg.Reva.Gateway.URL,
"gateway_addr": cfg.Reva.Gateway.Endpoint,
},
},
},
-174
View File
@@ -1,174 +0,0 @@
package command
import (
"context"
"os"
"os/signal"
"path"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
)
// StorageRoot is the entrypoint for the storage-root command.
func StorageRoot(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-root",
Usage: "Start storage-root service",
Flags: flagset.StorageRootWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageRoot.Services = c.StringSlice("service")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
if cfg.Tracing.Enabled {
switch t := cfg.Tracing.Type; t {
case "agent":
logger.Error().
Str("type", t).
Msg("Storage only supports the jaeger tracing backend")
case "jaeger":
logger.Info().
Str("type", t).
Msg("configuring storage to use the jaeger tracing backend")
case "zipkin":
logger.Error().
Str("type", t).
Msg("Storage only supports the jaeger tracing backend")
default:
logger.Warn().
Str("type", t).
Msg("Unknown tracing backend")
}
} else {
logger.Debug().
Msg("Tracing is not enabled")
}
var (
gr = run.Group{}
ctx, cancel = context.WithCancel(context.Background())
//metrics = metrics.New()
)
defer cancel()
{
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.StorageRoot.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-root",
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageRoot.Network,
"address": cfg.Reva.StorageRoot.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageRoot.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageRoot.MountPath,
"mount_id": cfg.Reva.StorageRoot.MountID,
"expose_data_server": cfg.Reva.StorageRoot.ExposeDataServer,
"data_server_url": cfg.Reva.StorageRoot.DataServerURL,
},
},
},
}
gr.Add(func() error {
runtime.RunWithOptions(
rcfg,
pidFile,
runtime.WithLogger(&logger.Logger),
)
return nil
}, func(_ error) {
logger.Info().
Str("server", c.Command.Name).
Msg("Shutting down server")
cancel()
})
}
{
server, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageRoot.DebugAddr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
)
if err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.ListenAndServe()
}, func(_ error) {
ctx, timeout := context.WithTimeout(ctx, 5*time.Second)
defer timeout()
defer cancel()
if err := server.Shutdown(ctx); err != nil {
logger.Info().
Err(err).
Str("server", c.Command.Name+"-debug").
Msg("Failed to shutdown server")
} else {
logger.Info().
Str("server", c.Command.Name+"-debug").
Msg("Shutting down server")
}
})
}
{
stop := make(chan os.Signal, 1)
gr.Add(func() error {
signal.Notify(stop, os.Interrupt)
<-stop
return nil
}, func(err error) {
close(stop)
cancel()
})
}
return gr.Run()
},
}
}
@@ -16,14 +16,14 @@ import (
"github.com/owncloud/ocis/storage/pkg/server/debug"
)
// StorageHomeData is the entrypoint for the storage-home-data command.
func StorageHomeData(cfg *config.Config) *cli.Command {
// StorageUsers is the entrypoint for the storage-users command.
func StorageUsers(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-home-data",
Usage: "Start storage-home-data service",
Flags: flagset.StorageHomeDataWithConfig(cfg),
Name: "storage-users",
Usage: "Start storage-users service",
Flags: flagset.StorageUsersWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.StorageHomeData.Services = c.StringSlice("service")
cfg.Reva.StorageHome.Services = c.StringSlice("service")
return nil
},
@@ -80,24 +80,39 @@ func StorageHomeData(cfg *config.Config) *cli.Command {
}
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
"max_cpus": cfg.Reva.StorageUsers.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "storage-home-data",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.URL, // Todo or address?
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageUsers.GRPCNetwork,
"address": cfg.Reva.StorageUsers.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageUsers.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageUsers.MountPath,
"mount_id": cfg.Reva.StorageUsers.MountID,
"expose_data_server": cfg.Reva.StorageUsers.ExposeDataServer,
"data_server_url": cfg.Reva.StorageUsers.DataServerURL,
},
},
},
"http": map[string]interface{}{
"network": cfg.Reva.StorageHomeData.Network,
"address": cfg.Reva.StorageHomeData.Addr,
"network": cfg.Reva.StorageUsers.HTTPNetwork,
"address": cfg.Reva.StorageUsers.HTTPAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageHomeData.Prefix,
"driver": cfg.Reva.StorageHomeData.Driver,
"prefix": cfg.Reva.StorageUsers.HTTPPrefix,
"driver": cfg.Reva.StorageUsers.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
@@ -126,7 +141,7 @@ func StorageHomeData(cfg *config.Config) *cli.Command {
{
server, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageHomeData.DebugAddr),
debug.Addr(cfg.Reva.StorageUsers.DebugAddr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
+3 -3
View File
@@ -76,14 +76,14 @@ func Users(cfg *config.Config) *cli.Command {
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": "users",
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.Users.Network,
"address": cfg.Reva.Users.Addr,
"network": cfg.Reva.Users.GRPCNetwork,
"address": cfg.Reva.Users.GRPCAddr,
// TODO build services dynamically
"services": map[string]interface{}{
"userprovider": map[string]interface{}{
+34 -34
View File
@@ -46,14 +46,19 @@ type Port struct {
// MaxCPUs can be a number or a percentage
MaxCPUs string
LogLevel string
// Network can be tcp, udp or unix
Network string
// Addr to listen on, hostname:port (0.0.0.0:9999 for all interfaces) or socket (/var/run/reva/sock)
Addr string
// GRPCNetwork can be tcp, udp or unix
GRPCNetwork string
// GRPCAddr to listen on, hostname:port (0.0.0.0:9999 for all interfaces) or socket (/var/run/reva/sock)
GRPCAddr string
// Protocol can be grpc or http
// HTTPNetwork can be tcp, udp or unix
HTTPNetwork string
// HTTPAddr to listen on, hostname:port (0.0.0.0:9100 for all interfaces) or socket (/var/run/reva/sock)
HTTPAddr string
// Protocol can be grpc or http
Protocol string
// URL is used by the gateway and registries (eg http://localhost:9100 or https://cloud.example.com)
URL string
// Endpoint is used by the gateway and registries (eg localhost:9100 or cloud.example.com)
Endpoint string
// DebugAddr for the debug endpoint to bind to
DebugAddr string
// Services can be used to give a list of services that should be started on this port
@@ -77,6 +82,13 @@ type FrontendPort struct {
DatagatewayPrefix string
OCDavPrefix string
OCSPrefix string
PublicURL string
}
// DataGatewayPort has a public url
type DataGatewayPort struct {
Port
PublicURL string
}
// StoragePort defines the available storage configuration.
@@ -86,10 +98,11 @@ type StoragePort struct {
MountPath string
MountID string
ExposeDataServer bool
DataServerURL string
// url the data gateway will use to route requests
DataServerURL string
// for HTTP ports with only one http service
Prefix string
HTTPPrefix string
TempFolder string
}
@@ -273,32 +286,19 @@ type Reva struct {
OCDav OCDav
Storages StorageConfig
// Ports are used to configure which services to start on which port
Frontend FrontendPort
DataGateway Port
Gateway Gateway
StorageRegistry StorageRegistry
Users Users
AuthProvider Users
AuthBasic Port
AuthBearer Port
Sharing Sharing
StorageRoot StoragePort
StorageRootData StoragePort
StorageHome StoragePort
StorageHomeData StoragePort
StorageEOS StoragePort
StorageEOSData StoragePort
StorageOC StoragePort
StorageOCData StoragePort
StorageS3 StoragePort
StorageS3Data StoragePort
StorageWND StoragePort
StorageWNDData StoragePort
StorageCustom StoragePort
StorageCustomData StoragePort
StoragePublicLink PublicStorage
StorageMetadata StoragePort
StorageMetadataData StoragePort
Frontend FrontendPort
DataGateway DataGatewayPort
Gateway Gateway
StorageRegistry StorageRegistry
Users Users
AuthProvider Users
AuthBasic Port
AuthBearer Port
Sharing Sharing
StorageHome StoragePort
StorageUsers StoragePort
StoragePublicLink PublicStorage
StorageMetadata StoragePort
// Configs can be used to configure the reva instance.
// Services and Ports will be ignored if this is used
Configs map[string]interface{}
+4 -18
View File
@@ -43,29 +43,15 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage auth-basic service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_BASIC_NETWORK"},
Destination: &cfg.Reva.AuthBasic.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_AUTH_BASIC_PROTOCOL"},
Destination: &cfg.Reva.AuthBasic.Protocol,
EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthBasic.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9146",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_ADDR"},
Destination: &cfg.Reva.AuthBasic.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9146",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_URL"},
Destination: &cfg.Reva.AuthBasic.URL,
EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_ADDR"},
Destination: &cfg.Reva.AuthBasic.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
+6 -20
View File
@@ -48,14 +48,14 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.OIDC.IDClaim,
},
&cli.StringFlag{
Name: "oidc-uid-claim",
Name: "oidc-uid-claim",
Value: "",
Usage: "OIDC uid claim",
EnvVars: []string{"STORAGE_OIDC_UID_CLAIM"},
Destination: &cfg.Reva.OIDC.UIDClaim,
},
&cli.StringFlag{
Name: "oidc-gid-claim",
Name: "oidc-gid-claim",
Value: "",
Usage: "OIDC gid claim",
EnvVars: []string{"STORAGE_OIDC_GID_CLAIM"},
@@ -70,29 +70,15 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_BEARER_NETWORK"},
Destination: &cfg.Reva.AuthBearer.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_AUTH_BEARER_PROTOCOL"},
Destination: &cfg.Reva.AuthBearer.Protocol,
EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthBearer.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9148",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_ADDR"},
Destination: &cfg.Reva.AuthBearer.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9148",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_URL"},
Destination: &cfg.Reva.AuthBearer.URL,
EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_ADDR"},
Destination: &cfg.Reva.AuthBearer.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
+10 -17
View File
@@ -42,7 +42,7 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
// this can eg. be set to /eos/users
&cli.StringFlag{
Name: "dav-files-namespace",
Value: "/oc/",
Value: "/users/",
Usage: "Namespace prefix for the webdav /dav/files endpoint",
EnvVars: []string{"DAV_FILES_NAMESPACE"},
Destination: &cfg.Reva.OCDav.DavFilesNamespace,
@@ -56,29 +56,22 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_FRONTEND_NETWORK"},
Destination: &cfg.Reva.Frontend.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_FRONTEND_PROTOCOL"},
Destination: &cfg.Reva.Frontend.Protocol,
EnvVars: []string{"STORAGE_FRONTEND_HTTP_NETWORK"},
Destination: &cfg.Reva.Frontend.HTTPNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9140",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_FRONTEND_ADDR"},
Destination: &cfg.Reva.Frontend.Addr,
EnvVars: []string{"STORAGE_FRONTEND_HTTP_ADDR"},
Destination: &cfg.Reva.Frontend.HTTPAddr,
},
&cli.StringFlag{
Name: "url",
Name: "public-url",
Value: "https://localhost:9200",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_FRONTEND_URL"},
Destination: &cfg.Reva.Frontend.URL,
EnvVars: []string{"STORAGE_FRONTEND_PUBLIC_URL"},
Destination: &cfg.Reva.Frontend.PublicURL,
},
&cli.StringSliceFlag{
Name: "service",
@@ -114,8 +107,8 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// Chunking
+63 -107
View File
@@ -45,29 +45,22 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_GATEWAY_NETWORK"},
Destination: &cfg.Reva.Gateway.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_GATEWAY_PROTOCOL"},
Destination: &cfg.Reva.Gateway.Protocol,
EnvVars: []string{"STORAGE_GATEWAY_GRPC_NETWORK"},
Destination: &cfg.Reva.Gateway.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9142",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_GATEWAY_ADDR"},
Destination: &cfg.Reva.Gateway.Addr,
EnvVars: []string{"STORAGE_GATEWAY_GRPC_ADDR"},
Destination: &cfg.Reva.Gateway.GRPCAddr,
},
&cli.StringFlag{
Name: "url",
Name: "endpoint",
Value: "localhost:9142",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
@@ -107,6 +100,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
// other services
&cli.StringFlag{
Name: "auth-basic-endpoint",
Value: "localhost:9146",
Usage: "endpoint to use for the basic auth provider",
EnvVars: []string{"STORAGE_AUTH_BASIC_ENDPOINT"},
Destination: &cfg.Reva.AuthBasic.Endpoint,
},
&cli.StringFlag{
Name: "auth-bearer-endpoint",
Value: "localhost:9148",
Usage: "endpoint to use for the bearer auth provider",
EnvVars: []string{"STORAGE_AUTH_BEARER_ENDPOINT"},
Destination: &cfg.Reva.AuthBearer.Endpoint,
},
// storage registry
&cli.StringFlag{
@@ -127,81 +135,47 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Name: "storage-home-provider",
Value: "/home",
Usage: "mount point of the storage provider for user homes in the global namespace",
EnvVars: []string{"STORAGE_STORAGE_HOME_PROVIDER"},
EnvVars: []string{"STORAGE_REGISTRY_HOME_PROVIDER"},
Destination: &cfg.Reva.StorageRegistry.HomeProvider,
},
&cli.StringFlag{
Name: "frontend-url",
Name: "public-url",
Value: "https://localhost:9200",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_FRONTEND_URL"},
Destination: &cfg.Reva.Frontend.URL,
EnvVars: []string{"STORAGE_FRONTEND_PUBLIC_URL"},
Destination: &cfg.Reva.Frontend.PublicURL,
},
&cli.StringFlag{
Name: "datagateway-url",
Value: "https://localhost:9200/data",
Usage: "URL to use for the storage datagateway",
EnvVars: []string{"STORAGE_DATAGATEWAY_URL"},
Destination: &cfg.Reva.DataGateway.URL,
EnvVars: []string{"STORAGE_DATAGATEWAY_PUBLIC_URL"},
Destination: &cfg.Reva.DataGateway.PublicURL,
},
&cli.StringFlag{
Name: "users-url",
Name: "userprovider-endpoint",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
Usage: "endpoint to use for the userprovider",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
&cli.StringFlag{
Name: "auth-basic-url",
Value: "localhost:9146",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_URL"},
Destination: &cfg.Reva.AuthBasic.URL,
},
&cli.StringFlag{
Name: "auth-bearer-url",
Value: "localhost:9148",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_URL"},
Destination: &cfg.Reva.AuthBearer.URL,
},
&cli.StringFlag{
Name: "sharing-url",
Name: "sharing-endpoint",
Value: "localhost:9150",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_URL"},
Destination: &cfg.Reva.Sharing.URL,
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_ENDPOINT"},
Destination: &cfg.Reva.Sharing.Endpoint,
},
&cli.StringFlag{
Name: "storage-root-url",
Value: "localhost:9152",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_ROOT_URL"},
Destination: &cfg.Reva.StorageRoot.URL,
},
&cli.StringFlag{
Name: "storage-root-mount-path",
Value: "/",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_PATH"},
Destination: &cfg.Reva.StorageRoot.MountPath,
},
&cli.StringFlag{
Name: "storage-root-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009152",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_ID"},
Destination: &cfg.Reva.StorageRoot.MountID,
},
// register home storage
&cli.StringFlag{
Name: "storage-home-url",
Name: "storage-home-endpoint",
Value: "localhost:9154",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_URL"},
Destination: &cfg.Reva.StorageHome.URL,
Usage: "endpoint to use for the home storage",
EnvVars: []string{"STORAGE_STORAGE_HOME_ENDPOINT"},
Destination: &cfg.Reva.StorageHome.Endpoint,
},
&cli.StringFlag{
Name: "storage-home-mount-path",
@@ -218,60 +192,42 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.StorageHome.MountID,
},
&cli.StringFlag{
Name: "storage-eos-url",
Value: "localhost:9158",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_URL"},
Destination: &cfg.Reva.StorageEOS.URL,
},
&cli.StringFlag{
Name: "storage-eos-mount-path",
Value: "/eos",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageEOS.MountPath,
},
&cli.StringFlag{
Name: "storage-eos-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009158",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_ID"},
Destination: &cfg.Reva.StorageEOS.MountID,
},
// register users storage
&cli.StringFlag{
Name: "storage-oc-url",
Value: "localhost:9162",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_URL"},
Destination: &cfg.Reva.StorageOC.URL,
Name: "storage-users-endpoint",
Value: "localhost:9157",
Usage: "endpoint to use for the users storage",
EnvVars: []string{"STORAGE_USERS_ENDPOINT"},
Destination: &cfg.Reva.StorageUsers.Endpoint,
},
&cli.StringFlag{
Name: "storage-oc-mount-path",
Value: "/oc",
Name: "storage-users-mount-path",
Value: "/users",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_PATH"},
Destination: &cfg.Reva.StorageOC.MountPath,
EnvVars: []string{"STORAGE_USERS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageUsers.MountPath,
},
&cli.StringFlag{
Name: "storage-oc-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009162",
Name: "storage-users-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009157",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_ID"},
Destination: &cfg.Reva.StorageOC.MountID,
EnvVars: []string{"STORAGE_USERS_MOUNT_ID"},
Destination: &cfg.Reva.StorageUsers.MountID,
},
// register public link storage
&cli.StringFlag{
Name: "public-link-url",
Name: "public-link-endpoint",
Value: "localhost:9178",
Usage: "URL to use for the public links service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_URL"},
Destination: &cfg.Reva.StoragePublicLink.URL,
Usage: "endpoint to use for the public links service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_ENDPOINT"},
Destination: &cfg.Reva.StoragePublicLink.Endpoint,
},
&cli.StringFlag{
Name: "storage-public-link-mount-path",
Value: "/public/",
Value: "/public",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
+4 -18
View File
@@ -26,29 +26,15 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_SHARING_NETWORK"},
Destination: &cfg.Reva.Sharing.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_SHARING_PROTOCOL"},
Destination: &cfg.Reva.Sharing.Protocol,
EnvVars: []string{"STORAGE_SHARING_GRPC_NETWORK"},
Destination: &cfg.Reva.Sharing.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9150",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_SHARING_ADDR"},
Destination: &cfg.Reva.Sharing.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9150",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_URL"},
Destination: &cfg.Reva.Sharing.URL,
EnvVars: []string{"STORAGE_SHARING_GRPC_ADDR"},
Destination: &cfg.Reva.Sharing.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
-104
View File
@@ -1,104 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageEOSWithConfig applies cfg to the root flagset
func StorageEOSWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9159",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_EOS_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageEOS.DebugAddr,
},
// Storage eos
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_EOS_NETWORK"},
Destination: &cfg.Reva.StorageEOS.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_EOS_PROTOCOL"},
Destination: &cfg.Reva.StorageEOS.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9158",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_ADDR"},
Destination: &cfg.Reva.StorageEOS.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9158",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_URL"},
Destination: &cfg.Reva.StorageEOS.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_EOS_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "eos",
Usage: "storage driver for eos mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_EOS_DRIVER"},
Destination: &cfg.Reva.StorageEOS.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/eos",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageEOS.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009158",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_ID"},
Destination: &cfg.Reva.StorageEOS.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_EOS_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageEOS.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9160/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageEOS.DataServerURL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
-111
View File
@@ -1,111 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageEOSDataWithConfig applies cfg to the root flagset
func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9161",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageEOSData.DebugAddr,
},
// Services
// Storage eos data
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_NETWORK"},
Destination: &cfg.Reva.StorageEOSData.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_PROTOCOL"},
Destination: &cfg.Reva.StorageEOSData.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9160",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_ADDR"},
Destination: &cfg.Reva.StorageEOSData.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9160",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_URL"},
Destination: &cfg.Reva.StorageEOSData.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "eos",
Usage: "storage driver for eos data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_DRIVER"},
Destination: &cfg.Reva.StorageEOSData.Driver,
},
&cli.StringFlag{
Name: "prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_PREFIX"},
Destination: &cfg.Reva.StorageEOSData.Prefix,
},
&cli.StringFlag{
Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_TEMP_FOLDER"},
Destination: &cfg.Reva.StorageEOSData.TempFolder,
},
// Gateway
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+67 -41
View File
@@ -12,9 +12,9 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9155",
Value: "0.0.0.0:9156",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_HOME_DEBUG_ADDR"},
EnvVars: []string{"STORAGE_HOME_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageHome.DebugAddr,
},
@@ -23,95 +23,121 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
// Storage home
&cli.StringFlag{
Name: "network",
Name: "grpc-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_HOME_NETWORK"},
Destination: &cfg.Reva.StorageHome.Network,
EnvVars: []string{"STORAGE_HOME_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageHome.GRPCNetwork,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_HOME_PROTOCOL"},
Destination: &cfg.Reva.StorageHome.Protocol,
},
&cli.StringFlag{
Name: "addr",
Name: "grpc-addr",
Value: "0.0.0.0:9154",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_ADDR"},
Destination: &cfg.Reva.StorageHome.Addr,
EnvVars: []string{"STORAGE_HOME_GRPC_ADDR"},
Destination: &cfg.Reva.StorageHome.GRPCAddr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9154",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_URL"},
Destination: &cfg.Reva.StorageHome.URL,
Name: "http-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_HOME_HTTP_NETWORK"},
Destination: &cfg.Reva.StorageHome.HTTPNetwork,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_HOME_SERVICES"},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9155",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_HOME_HTTP_ADDR"},
Destination: &cfg.Reva.StorageHome.HTTPAddr,
},
// TODO allow disabling grpc / http services
/*
&cli.StringSliceFlag{
Name: "grpc-service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_HOME_GRPC_SERVICES"},
},
&cli.StringSliceFlag{
Name: "http-service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_HOME_HTTP_SERVICES"},
},
*/
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Value: "ocis",
Usage: "storage driver for home mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_HOME_DRIVER"},
EnvVars: []string{"STORAGE_HOME_DRIVER"},
Destination: &cfg.Reva.StorageHome.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/home",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_HOME_MOUNT_PATH"},
EnvVars: []string{"STORAGE_HOME_MOUNT_PATH"},
Destination: &cfg.Reva.StorageHome.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
// This is the mount id of the storage provider using the same storage driver
// as /home but withoud home enabled. Set it to
// 1284d238-aa92-42ce-bdc4-0b0000009158 for /eos
// 1284d238-aa92-42ce-bdc4-0b0000009162 for /oc
Value: "1284d238-aa92-42ce-bdc4-0b0000009162", // /oc
// as /home but withoud home enabled.
Value: "1284d238-aa92-42ce-bdc4-0b0000009157", // /users
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_HOME_MOUNT_ID"},
EnvVars: []string{"STORAGE_HOME_MOUNT_ID"},
Destination: &cfg.Reva.StorageHome.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_HOME_EXPOSE_DATA_SERVER"},
EnvVars: []string{"STORAGE_HOME_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageHome.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9156/data",
Value: "http://localhost:9155/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_SERVER_URL"},
EnvVars: []string{"STORAGE_HOME_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageHome.DataServerURL,
},
&cli.StringFlag{
Name: "http-prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_HOME_HTTP_PREFIX"},
Destination: &cfg.Reva.StorageHome.HTTPPrefix,
},
&cli.BoolFlag{
Name: "enable-home",
Value: true,
Usage: "enable the creation of home directories",
EnvVars: []string{"STORAGE_STORAGE_HOME_ENABLE_HOME"},
EnvVars: []string{"STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Name: "users-endpoint",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
-118
View File
@@ -1,118 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageHomeDataWithConfig applies cfg to the root flagset
func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9157",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageHomeData.DebugAddr,
},
// Services
// Storage home data
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_NETWORK"},
Destination: &cfg.Reva.StorageHomeData.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_PROTOCOL"},
Destination: &cfg.Reva.StorageHomeData.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9156",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_ADDR"},
Destination: &cfg.Reva.StorageHomeData.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9156",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_URL"},
Destination: &cfg.Reva.StorageHomeData.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver for home data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_DRIVER"},
Destination: &cfg.Reva.StorageHomeData.Driver,
},
&cli.StringFlag{
Name: "prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_PREFIX"},
Destination: &cfg.Reva.StorageHomeData.Prefix,
},
&cli.StringFlag{
Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_TEMP_FOLDER"},
Destination: &cfg.Reva.StorageHomeData.TempFolder,
},
&cli.BoolFlag{
Name: "enable-home",
Value: true,
Usage: "enable the creation of home directories",
EnvVars: []string{"STORAGE_STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// Gateway
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+51 -28
View File
@@ -12,57 +12,72 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
Name: "debug-addr",
Value: "0.0.0.0:9217",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DEBUG_ADDR"},
EnvVars: []string{"STORAGE_METADATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageMetadata.DebugAddr,
},
&cli.StringFlag{
Name: "network",
Name: "grpc-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_METADATA_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.Network,
EnvVars: []string{"STORAGE_METADATA_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.GRPCNetwork,
},
&cli.StringFlag{
Name: "provider-addr",
Name: "grpc-addr",
Value: "0.0.0.0:9215",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_METADATA_PROVIDER_ADDR"},
Destination: &cfg.Reva.StorageMetadata.Addr,
EnvVars: []string{"STORAGE_METADATA_GRPC_PROVIDER_ADDR"},
Destination: &cfg.Reva.StorageMetadata.GRPCAddr,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9216",
Usage: "URL of the data-server the storage-provider uses",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DATA_SERVER_URL"},
Usage: "URL of the data-provider the storage-provider uses",
EnvVars: []string{"STORAGE_METADATA_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageMetadata.DataServerURL,
},
&cli.StringFlag{
Name: "data-server-addr",
Value: "0.0.0.0:9216",
Usage: "Address to bind the metadata data-server to",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DATA_SERVER_ADDR"},
Destination: &cfg.Reva.StorageMetadataData.Addr,
Name: "http-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_METADATA_HTTP_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.HTTPNetwork,
},
&cli.StringFlag{
Name: "storage-provider-driver",
Value: "local",
Name: "http-addr",
Value: "0.0.0.0:9216",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_METADATA_HTTP_ADDR"},
Destination: &cfg.Reva.StorageMetadata.HTTPAddr,
},
&cli.StringFlag{
Name: "driver",
Value: "ocis",
Usage: "storage driver for metadata mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_METADATA_PROVIDER_DRIVER"},
EnvVars: []string{"STORAGE_METADATA_DRIVER"},
Destination: &cfg.Reva.StorageMetadata.Driver,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "data-provider-driver",
Value: "local",
Usage: "storage driver for data-provider mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DATA_PROVIDER_DRIVER"},
Destination: &cfg.Reva.StorageMetadataData.Driver,
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "endpoint to use for the gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "storage-root",
Value: "/var/tmp/ocis/metadata",
Usage: "the path to the metadata storage root",
EnvVars: []string{"STORAGE_STORAGE_METADATA_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
Name: "userprovider-endpoint",
Value: "localhost:9144",
Usage: "endpoint to use for the userprovider service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
@@ -73,7 +88,15 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
flags = append(flags,
&cli.StringFlag{
Name: "storage-root",
Value: "/var/tmp/ocis/metadata",
Usage: "the path to the metadata storage root",
EnvVars: []string{"STORAGE_METADATA_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
},
)
return flags
}
-116
View File
@@ -1,116 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageOCWithConfig applies cfg to the root flagset
func StorageOCWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9163",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_OC_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageOC.DebugAddr,
},
// Services
// Storage oc
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_OC_NETWORK"},
Destination: &cfg.Reva.StorageOC.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_OC_PROTOCOL"},
Destination: &cfg.Reva.StorageOC.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9162",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_ADDR"},
Destination: &cfg.Reva.StorageOC.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9162",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_URL"},
Destination: &cfg.Reva.StorageOC.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_OC_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver for oc mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_OC_DRIVER"},
Destination: &cfg.Reva.StorageOC.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/oc",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_PATH"},
Destination: &cfg.Reva.StorageOC.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009162",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_ID"},
Destination: &cfg.Reva.StorageOC.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_OC_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageOC.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9164/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageOC.DataServerURL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
-111
View File
@@ -1,111 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageOCDataWithConfig applies cfg to the root flagset
func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9165",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageOCData.DebugAddr,
},
// Services
// Storage oc data
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_NETWORK"},
Destination: &cfg.Reva.StorageOCData.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_PROTOCOL"},
Destination: &cfg.Reva.StorageOCData.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9164",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_ADDR"},
Destination: &cfg.Reva.StorageOCData.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9164",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_URL"},
Destination: &cfg.Reva.StorageOCData.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver for oc data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DRIVER"},
Destination: &cfg.Reva.StorageOCData.Driver,
},
&cli.StringFlag{
Name: "prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_PREFIX"},
Destination: &cfg.Reva.StorageOCData.Prefix,
},
&cli.StringFlag{
Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_TEMP_FOLDER"},
Destination: &cfg.Reva.StorageOCData.TempFolder,
},
// Gateway
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+11 -25
View File
@@ -13,7 +13,7 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
Name: "debug-addr",
Value: "0.0.0.0:9179",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_DEBUG_ADDR"},
EnvVars: []string{"STORAGE_PUBLIC_LINK_DEBUG_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.DebugAddr,
},
@@ -21,45 +21,31 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_NETWORK"},
Destination: &cfg.Reva.StoragePublicLink.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_PROTOCOL"},
Destination: &cfg.Reva.StoragePublicLink.Protocol,
EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_NETWORK"},
Destination: &cfg.Reva.StoragePublicLink.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9178",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9178",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_URL"},
Destination: &cfg.Reva.StoragePublicLink.URL,
EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.GRPCAddr,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/public/",
Value: "/public",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_MOUNT_PATH"},
EnvVars: []string{"STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
},
&cli.StringFlag{
Name: "gateway-url",
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
-105
View File
@@ -1,105 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageRootWithConfig applies cfg to the root flagset
func StorageRootWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9153",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_ROOT_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageRoot.DebugAddr,
},
// Services
// Storage root
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_ROOT_NETWORK"},
Destination: &cfg.Reva.StorageRoot.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_ROOT_PROTOCOL"},
Destination: &cfg.Reva.StorageRoot.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9152",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_ROOT_ADDR"},
Destination: &cfg.Reva.StorageRoot.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9152",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_ROOT_URL"},
Destination: &cfg.Reva.StorageRoot.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_ROOT_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "local",
Usage: "storage driver for root mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_ROOT_DRIVER"},
Destination: &cfg.Reva.StorageRoot.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_PATH"},
Destination: &cfg.Reva.StorageRoot.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "123e4567-e89b-12d3-a456-426655440001",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_ID"},
Destination: &cfg.Reva.StorageRoot.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_ROOT_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageRoot.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_ROOT_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageRoot.DataServerURL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+143
View File
@@ -0,0 +1,143 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageUsersWithConfig applies cfg to the root flagset
func StorageUsersWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9159",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_USERS_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageUsers.DebugAddr,
},
// Services
// Storage home
&cli.StringFlag{
Name: "grpc-network",
Value: "tcp",
Usage: "Network to use for the users storage, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERS_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageUsers.GRPCNetwork,
},
&cli.StringFlag{
Name: "grpc-addr",
Value: "0.0.0.0:9157",
Usage: "GRPC Address to bind users storage",
EnvVars: []string{"STORAGE_USERS_GRPC_ADDR"},
Destination: &cfg.Reva.StorageUsers.GRPCAddr,
},
&cli.StringFlag{
Name: "http-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERS_HTTP_NETWORK"},
Destination: &cfg.Reva.StorageUsers.HTTPNetwork,
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9158",
Usage: "HTTP Address to bind users storage",
EnvVars: []string{"STORAGE_USERS_HTTP_ADDR"},
Destination: &cfg.Reva.StorageUsers.HTTPAddr,
},
// TODO allow disabling grpc / http services
/*
&cli.StringSliceFlag{
Name: "grpc-service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERS_GRPC_SERVICES"},
},
&cli.StringSliceFlag{
Name: "http-service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERS_HTTP_SERVICES"},
},
*/
&cli.StringFlag{
Name: "driver",
Value: "ocis",
Usage: "storage driver for users mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_USERS_DRIVER"},
Destination: &cfg.Reva.StorageUsers.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/users",
Usage: "mount path",
EnvVars: []string{"STORAGE_USERS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageUsers.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009157", // /users
Usage: "mount id",
EnvVars: []string{"STORAGE_USERS_MOUNT_ID"},
Destination: &cfg.Reva.StorageUsers.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_USERS_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageUsers.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9158/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_USERS_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageUsers.DataServerURL,
},
&cli.StringFlag{
Name: "http-prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_USERS_HTTP_PREFIX"},
Destination: &cfg.Reva.StorageUsers.HTTPPrefix,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "users-endpoint",
Value: "localhost:9144",
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+11 -18
View File
@@ -20,55 +20,48 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag {
// Services
// Users
// Userprovider
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERS_NETWORK"},
Destination: &cfg.Reva.Users.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_USERS_PROTOCOL"},
Destination: &cfg.Reva.Users.Protocol,
EnvVars: []string{"STORAGE_USERPROVIDER_NETWORK"},
Destination: &cfg.Reva.Users.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9144",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_USERS_ADDR"},
Destination: &cfg.Reva.Users.Addr,
EnvVars: []string{"STORAGE_USERPROVIDER_ADDR"},
Destination: &cfg.Reva.Users.GRPCAddr,
},
&cli.StringFlag{
Name: "url",
Name: "endpoint",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("userprovider"), // TODO preferences
Usage: "--service userprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERS_SERVICES"},
EnvVars: []string{"STORAGE_USERPROVIDER_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "ldap",
Usage: "user driver: 'demo', 'json', 'ldap', or 'rest'",
EnvVars: []string{"STORAGE_USERS_DRIVER"},
EnvVars: []string{"STORAGE_USERPROVIDER_DRIVER"},
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "json-config",
Value: "",
Usage: "Path to users.json file",
EnvVars: []string{"STORAGE_USERS_JSON"},
EnvVars: []string{"STORAGE_USERPROVIDER_JSON"},
Destination: &cfg.Reva.Users.JSON,
},