delete storage flagsets

This commit is contained in:
A.Unger
2021-11-17 09:47:00 +01:00
parent 9c7c2b6dc9
commit 017eea8f2b
34 changed files with 3 additions and 3202 deletions

View File

@@ -5,7 +5,6 @@ import (
"net/http"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/urfave/cli/v2"
)
@@ -14,7 +13,9 @@ func Health(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "health",
Usage: "Check health status",
Flags: flagset.HealthWithConfig(cfg),
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg, "storage")
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)

View File

@@ -1,144 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// AppProviderWithConfig applies cfg to the root flagset
func AppProviderWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.DebugAddr, "127.0.0.1:9165"),
Usage: "Address to bind debug server",
EnvVars: []string{"APP_PROVIDER_BASIC_DEBUG_ADDR"},
Destination: &cfg.Reva.AppProvider.DebugAddr,
},
// Auth
// Services
// AppProvider
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage auth-basic service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"APP_PROVIDER_BASIC_GRPC_NETWORK"},
Destination: &cfg.Reva.AppProvider.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.GRPCAddr, "127.0.0.1:9164"),
Usage: "Address to bind storage service",
EnvVars: []string{"APP_PROVIDER_BASIC_GRPC_ADDR"},
Destination: &cfg.Reva.AppProvider.GRPCAddr,
},
&cli.StringFlag{
Name: "external-addr",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.ExternalAddr, "127.0.0.1:9164"),
Usage: "Address to connect to the storage service for other services",
EnvVars: []string{"APP_PROVIDER_BASIC_EXTERNAL_ADDR"},
Destination: &cfg.Reva.AppProvider.ExternalAddr,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("appprovider"),
Usage: "--service appprovider [--service otherservice]",
EnvVars: []string{"APP_PROVIDER_BASIC_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.Driver, ""),
Usage: "Driver to use for app provider",
EnvVars: []string{"APP_PROVIDER_DRIVER"},
Destination: &cfg.Reva.AppProvider.Driver,
},
// WOPI driver
&cli.StringFlag{
Name: "wopi-driver-app-apikey",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.AppAPIKey, ""),
Usage: "The API key used by the app, if applicable.",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_API_KEY"},
Destination: &cfg.Reva.AppProvider.WopiDriver.AppAPIKey,
},
&cli.BoolFlag{
Name: "wopi-driver-app-desktop-only",
Value: flags.OverrideDefaultBool(cfg.Reva.AppProvider.WopiDriver.AppDesktopOnly, false),
Usage: "Whether the app can be opened only on desktop",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_DESKTOP_ONLY"},
Destination: &cfg.Reva.AppProvider.WopiDriver.AppDesktopOnly,
},
&cli.StringFlag{
Name: "wopi-driver-app-icon-uri",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.AppIconURI, ""),
Usage: "IOP Secret (Shared with WOPI server)",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_ICON_URI"},
Destination: &cfg.Reva.AppProvider.WopiDriver.AppIconURI,
},
&cli.StringFlag{
Name: "wopi-driver-app-internal-url",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.AppInternalURL, ""),
Usage: "The internal app URL in case of dockerized deployments. Defaults to AppURL",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_INTERNAL_URL"},
Destination: &cfg.Reva.AppProvider.WopiDriver.AppInternalURL,
},
&cli.StringFlag{
Name: "wopi-driver-app-name",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.AppName, ""),
Usage: "The App user-friendly name.",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_NAME"},
Destination: &cfg.Reva.AppProvider.WopiDriver.AppName,
},
&cli.StringFlag{
Name: "wopi-driver-app-url",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.AppURL, ""),
Usage: "App server URL",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_APP_URL"},
Destination: &cfg.Reva.AppProvider.WopiDriver.AppURL,
},
&cli.BoolFlag{
Name: "wopi-driver-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.AppProvider.WopiDriver.Insecure, false),
Usage: "Disable SSL certificate verification of WOPI server and WOPI bridge",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_INSECURE"},
Destination: &cfg.Reva.AppProvider.WopiDriver.Insecure,
},
&cli.StringFlag{
Name: "wopi-driver-iopsecret",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.IopSecret, ""),
Usage: "IOP Secret (Shared with WOPI server)",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_IOP_SECRET"},
Destination: &cfg.Reva.AppProvider.WopiDriver.IopSecret,
},
&cli.StringFlag{
Name: "wopi-driver-wopiurl",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiDriver.WopiURL, ""),
Usage: "WOPI server URL",
EnvVars: []string{"APP_PROVIDER_WOPI_DRIVER_WOPI_URL"},
Destination: &cfg.Reva.AppProvider.WopiDriver.WopiURL,
},
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,81 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// AuthBasicWithConfig applies cfg to the root flagset
func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBasic.DebugAddr, "127.0.0.1:9147"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_AUTH_BASIC_DEBUG_ADDR"},
Destination: &cfg.Reva.AuthBasic.DebugAddr,
},
// Auth
&cli.StringFlag{
Name: "auth-driver",
Value: flags.OverrideDefaultString(cfg.Reva.AuthProvider.Driver, "ldap"),
Usage: "auth driver: 'demo', 'json' or 'ldap'",
EnvVars: []string{"STORAGE_AUTH_DRIVER"},
Destination: &cfg.Reva.AuthProvider.Driver,
},
&cli.StringFlag{
Name: "auth-json",
Value: flags.OverrideDefaultString(cfg.Reva.AuthProvider.JSON, ""),
Usage: "Path to users.json file",
EnvVars: []string{"STORAGE_AUTH_JSON"},
Destination: &cfg.Reva.AuthProvider.JSON,
},
// Services
// AuthBasic
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBasic.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage auth-basic service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthBasic.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBasic.GRPCAddr, "127.0.0.1:9146"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_ADDR"},
Destination: &cfg.Reva.AuthBasic.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("authprovider"),
Usage: "--service authprovider [--service otherservice]",
EnvVars: []string{"STORAGE_AUTH_BASIC_SERVICES"},
},
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, LDAPWithConfig(cfg)...)
return flags
}

View File

@@ -1,107 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// AuthBearerWithConfig applies cfg to the root flagset
func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBearer.DebugAddr, "127.0.0.1:9149"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_AUTH_BEARER_DEBUG_ADDR"},
Destination: &cfg.Reva.AuthBearer.DebugAddr,
},
// OIDC
&cli.StringFlag{
Name: "oidc-issuer",
Value: flags.OverrideDefaultString(cfg.Reva.OIDC.Issuer, "https://localhost:9200"),
Usage: "OIDC issuer",
EnvVars: []string{"STORAGE_OIDC_ISSUER", "OCIS_URL"}, // STORAGE_OIDC_ISSUER takes precedence over OCIS_URL
Destination: &cfg.Reva.OIDC.Issuer,
},
&cli.BoolFlag{
Name: "oidc-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.OIDC.Insecure, false),
Usage: "OIDC allow insecure communication",
EnvVars: []string{"STORAGE_OIDC_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.OIDC.Insecure,
},
&cli.StringFlag{
Name: "oidc-id-claim",
// preferred_username is a workaround
// the user manager needs to take care of the sub to user metadata lookup, which ldap cannot do
// TODO sub is stable and defined as unique.
// AFAICT we want to use the account id from ocis-accounts
// TODO add an ocis middleware to storage that changes the users opaqueid?
// TODO add an ocis-accounts backed user manager
Value: flags.OverrideDefaultString(cfg.Reva.OIDC.IDClaim, "preferred_username"),
Usage: "OIDC id claim",
EnvVars: []string{"STORAGE_OIDC_ID_CLAIM"},
Destination: &cfg.Reva.OIDC.IDClaim,
},
&cli.StringFlag{
Name: "oidc-uid-claim",
Value: flags.OverrideDefaultString(cfg.Reva.OIDC.UIDClaim, ""),
Usage: "OIDC uid claim",
EnvVars: []string{"STORAGE_OIDC_UID_CLAIM"},
Destination: &cfg.Reva.OIDC.UIDClaim,
},
&cli.StringFlag{
Name: "oidc-gid-claim",
Value: flags.OverrideDefaultString(cfg.Reva.OIDC.GIDClaim, ""),
Usage: "OIDC gid claim",
EnvVars: []string{"STORAGE_OIDC_GID_CLAIM"},
Destination: &cfg.Reva.OIDC.GIDClaim,
},
// Services
// AuthBearer
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBearer.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthBearer.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBearer.GRPCAddr, "127.0.0.1:9148"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_ADDR"},
Destination: &cfg.Reva.AuthBearer.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("authprovider"), // TODO preferences
Usage: "--service authprovider [--service otherservice]",
EnvVars: []string{"STORAGE_AUTH_BEARER_SERVICES"},
},
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,73 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// AuthMachineWithConfig applies cfg to the root flagset
func AuthMachineWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.AuthMachine.DebugAddr, "127.0.0.1:9167"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_AUTH_MACHINE_DEBUG_ADDR"},
Destination: &cfg.Reva.AuthMachine.DebugAddr,
},
// Machine Auth
&cli.StringFlag{
Name: "machine-auth-api-key",
Value: flags.OverrideDefaultString(cfg.Reva.AuthMachineConfig.MachineAuthAPIKey, "change-me-please"),
Usage: "the API key to be used for the machine auth driver in reva",
EnvVars: []string{"STORAGE_AUTH_MACHINE_AUTH_API_KEY", "OCIS_MACHINE_AUTH_API_KEY"},
Destination: &cfg.Reva.AuthMachineConfig.MachineAuthAPIKey,
},
// Services
// AuthMachine
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.AuthMachine.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_MACHINE_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthMachine.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.AuthMachine.GRPCAddr, "127.0.0.1:9166"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_MACHINE_GRPC_ADDR"},
Destination: &cfg.Reva.AuthMachine.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("authprovider"), // TODO preferences
Usage: "--service authprovider [--service otherservice]",
EnvVars: []string{"STORAGE_AUTH_MACHINE_SERVICES"},
},
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,32 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DebugWithConfig applies common debug config cfg to the flagset
func DebugWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-token",
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
Usage: "Token to grant metrics access",
EnvVars: []string{"STORAGE_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
},
&cli.BoolFlag{
Name: "debug-pprof",
Usage: "Enable pprof debugging",
EnvVars: []string{"STORAGE_DEBUG_PPROF"},
Destination: &cfg.Debug.Pprof,
},
&cli.BoolFlag{
Name: "debug-zpages",
Usage: "Enable zpages debugging",
EnvVars: []string{"STORAGE_DEBUG_ZPAGES"},
Destination: &cfg.Debug.Zpages,
},
}
}

View File

@@ -1,299 +0,0 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/userdrivers"
"github.com/urfave/cli/v2"
)
// FrontendWithConfig applies cfg to the root flagset
func FrontendWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.DebugAddr, "127.0.0.1:9141"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_FRONTEND_DEBUG_ADDR"},
Destination: &cfg.Reva.Frontend.DebugAddr,
},
// REVA
&cli.StringFlag{
Name: "transfer-secret",
Value: flags.OverrideDefaultString(cfg.Reva.TransferSecret, "replace-me-with-a-transfer-secret"),
Usage: "Transfer secret for datagateway",
EnvVars: []string{"STORAGE_TRANSFER_SECRET"},
Destination: &cfg.Reva.TransferSecret,
},
// OCDav
&cli.StringFlag{
Name: "chunk-folder",
Value: flags.OverrideDefaultString(cfg.Reva.OCDav.WebdavNamespace, path.Join(defaults.BaseDataPath(), "tmp", "chunks")),
Usage: "temp directory for chunked uploads",
EnvVars: []string{"STORAGE_CHUNK_FOLDER"},
Destination: &cfg.Reva.OCDav.WebdavNamespace,
},
&cli.StringFlag{
Name: "webdav-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.OCDav.WebdavNamespace, "/home/"),
Usage: "Namespace prefix for the /webdav endpoint",
EnvVars: []string{"STORAGE_WEBDAV_NAMESPACE"},
Destination: &cfg.Reva.OCDav.WebdavNamespace,
},
// th/dav/files endpoint expects a username as the first path segment
// this can eg. be set to /eos/users
&cli.StringFlag{
Name: "dav-files-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.OCDav.DavFilesNamespace, "/users/"),
Usage: "Namespace prefix for the webdav /dav/files endpoint",
EnvVars: []string{"STORAGE_DAV_FILES_NAMESPACE"},
Destination: &cfg.Reva.OCDav.DavFilesNamespace,
},
// Archiver
&cli.Int64Flag{
Name: "archiver-max-num-files",
Value: flags.OverrideDefaultInt64(cfg.Reva.Archiver.MaxNumFiles, 10000),
Usage: "Maximum number of files to be included in the archiver",
EnvVars: []string{"STORAGE_ARCHIVER_MAX_NUM_FILES"},
Destination: &cfg.Reva.Archiver.MaxNumFiles,
},
&cli.Int64Flag{
Name: "archiver-max-size",
Value: flags.OverrideDefaultInt64(cfg.Reva.Archiver.MaxSize, 1073741824), // 1GB
Usage: "Maximum size for the sum of the sizes of all the files included in the archive",
EnvVars: []string{"STORAGE_ARCHIVER_MAX_SIZE"},
Destination: &cfg.Reva.Archiver.MaxSize,
},
// Services
// Frontend
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.HTTPNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_FRONTEND_HTTP_NETWORK"},
Destination: &cfg.Reva.Frontend.HTTPNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.HTTPAddr, "127.0.0.1:9140"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_FRONTEND_HTTP_ADDR"},
Destination: &cfg.Reva.Frontend.HTTPAddr,
},
// please note that STORAGE_FRONTEND_PUBLIC_URL is also defined in
// storage/pkg/flagset/gateway.go because this setting may be consumed
// by both the gateway and frontend service
&cli.StringFlag{
Name: "public-url",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.PublicURL, "https://localhost:9200"),
Usage: "URL to use for the storage service",
EnvVars: []string{"OCIS_URL", "STORAGE_FRONTEND_PUBLIC_URL"}, // STORAGE_FRONTEND_PUBLIC_URL takes precedence over OCIS_URL
Destination: &cfg.Reva.Frontend.PublicURL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("datagateway", "ocdav", "ocs", "appprovider"),
Usage: "--service ocdav [--service ocs]",
EnvVars: []string{"STORAGE_FRONTEND_SERVICES"},
},
&cli.StringFlag{
Name: "approvider-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.AppProviderPrefix, ""),
Usage: "approvider prefix",
EnvVars: []string{"STORAGE_FRONTEND_APPPROVIDER_PREFIX"},
Destination: &cfg.Reva.Frontend.AppProviderPrefix,
},
&cli.BoolFlag{
Name: "approvider-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.Frontend.AppProviderInsecure, false),
Usage: "approvider insecure",
EnvVars: []string{"STORAGE_FRONTEND_APPPROVIDER_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.Frontend.AppProviderInsecure,
},
&cli.StringFlag{
Name: "archiver-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.ArchiverPrefix, "archiver"),
Usage: "archiver prefix",
EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_PREFIX"},
Destination: &cfg.Reva.Frontend.ArchiverPrefix,
},
&cli.BoolFlag{
Name: "archiver-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.Frontend.ArchiverInsecure, false),
Usage: "archiver insecure",
EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.Frontend.ArchiverInsecure,
},
&cli.StringFlag{
Name: "datagateway-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.DatagatewayPrefix, "data"),
Usage: "datagateway prefix",
EnvVars: []string{"STORAGE_FRONTEND_DATAGATEWAY_PREFIX"},
Destination: &cfg.Reva.Frontend.DatagatewayPrefix,
},
&cli.BoolFlag{
Name: "favorites",
Value: flags.OverrideDefaultBool(cfg.Reva.Frontend.Favorites, false),
Usage: "announces favorites support to clients",
EnvVars: []string{"STORAGE_FRONTEND_FAVORITES"},
Destination: &cfg.Reva.Frontend.Favorites,
},
&cli.StringFlag{
Name: "ocdav-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCDavPrefix, ""),
Usage: "owncloud webdav endpoint prefix",
EnvVars: []string{"STORAGE_FRONTEND_OCDAV_PREFIX"},
Destination: &cfg.Reva.Frontend.OCDavPrefix,
},
&cli.BoolFlag{
Name: "ocdav-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.Frontend.OCDavInsecure, false),
Usage: "owncloud webdav insecure",
EnvVars: []string{"STORAGE_FRONTEND_OCDAV_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.Frontend.OCDavInsecure,
},
&cli.StringFlag{
Name: "ocs-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCSPrefix, "ocs"),
Usage: "open collaboration services endpoint prefix",
EnvVars: []string{"STORAGE_FRONTEND_OCS_PREFIX"},
Destination: &cfg.Reva.Frontend.OCSPrefix,
},
&cli.StringFlag{
Name: "ocs-share-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCSSharePrefix, "/Shares"),
Usage: "the prefix prepended to the path of shared files",
EnvVars: []string{"STORAGE_FRONTEND_OCS_SHARE_PREFIX"},
Destination: &cfg.Reva.Frontend.OCSSharePrefix,
},
&cli.StringFlag{
Name: "ocs-home-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCSHomeNamespace, "/home"),
Usage: "the prefix prepended to the incoming requests in OCS",
EnvVars: []string{"STORAGE_FRONTEND_OCS_HOME_NAMESPACE"},
Destination: &cfg.Reva.Frontend.OCSHomeNamespace,
},
&cli.IntFlag{
Name: "ocs-resource-info-cache-ttl",
Value: flags.OverrideDefaultInt(cfg.Reva.Frontend.OCSResourceInfoCacheTTL, 0),
Usage: "the TTL for statted resources in the share cache",
EnvVars: []string{"STORAGE_FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL"},
Destination: &cfg.Reva.Frontend.OCSResourceInfoCacheTTL,
},
&cli.StringFlag{
Name: "ocs-cache-warmup-driver",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCSCacheWarmupDriver, ""),
Usage: "the driver to be used for warming up the share cache",
EnvVars: []string{"STORAGE_FRONTEND_OCS_CACHE_WARMUP_DRIVER"},
Destination: &cfg.Reva.Frontend.OCSCacheWarmupDriver,
},
&cli.StringFlag{
Name: "ocs-additional-info-attribute",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.OCSAdditionalInfoAttribute, "{{.Mail}}"),
Usage: "the additional info to be returned when searching for users",
EnvVars: []string{"STORAGE_FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE"},
Destination: &cfg.Reva.Frontend.OCSAdditionalInfoAttribute,
},
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// Chunking
&cli.StringFlag{
Name: "default-upload-protocol",
Value: flags.OverrideDefaultString(cfg.Reva.DefaultUploadProtocol, "tus"),
Usage: "Default upload chunking protocol to be used out of tus/v1/ng",
EnvVars: []string{"STORAGE_FRONTEND_DEFAULT_UPLOAD_PROTOCOL"},
Destination: &cfg.Reva.DefaultUploadProtocol,
},
&cli.IntFlag{
Name: "upload-max-chunk-size",
Value: flags.OverrideDefaultInt(cfg.Reva.UploadMaxChunkSize, 1e+8), // 0.1 GB
Usage: "Max chunk size in bytes to advertise to clients through capabilities, or 0 for unlimited",
EnvVars: []string{"STORAGE_FRONTEND_UPLOAD_MAX_CHUNK_SIZE"},
Destination: &cfg.Reva.UploadMaxChunkSize,
},
&cli.StringFlag{
Name: "upload-http-method-override",
Value: flags.OverrideDefaultString(cfg.Reva.UploadHTTPMethodOverride, ""),
Usage: "Specify an HTTP method (ex: POST) that clients should to use when uploading instead of PATCH",
EnvVars: []string{"STORAGE_FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE"},
Destination: &cfg.Reva.UploadHTTPMethodOverride,
},
&cli.StringSliceFlag{
Name: "checksum-supported-type",
Value: cli.NewStringSlice("sha1", "md5", "adler32"),
Usage: "--checksum-supported-type sha1 [--checksum-supported-type adler32]",
EnvVars: []string{"STORAGE_FRONTEND_CHECKSUM_SUPPORTED_TYPES"},
},
&cli.StringFlag{
Name: "checksum-preferred-upload-type",
Value: flags.OverrideDefaultString(cfg.Reva.ChecksumPreferredUploadType, ""),
Usage: "Specify the preferred checksum algorithm used for uploads",
EnvVars: []string{"STORAGE_FRONTEND_CHECKSUM_PREFERRED_UPLOAD_TYPE"},
Destination: &cfg.Reva.ChecksumPreferredUploadType,
},
// Archiver
&cli.StringFlag{
Name: "archiver-url",
Value: flags.OverrideDefaultString(cfg.Reva.Archiver.ArchiverURL, "/archiver"),
Usage: "URL where the archiver is reachable",
EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_URL"},
Destination: &cfg.Reva.Archiver.ArchiverURL,
},
// App Provider
&cli.StringFlag{
Name: "appprovider-apps-url",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.AppsURL, "/app/list"),
Usage: "URL where the app listing of the app provider is reachable",
EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_APPS_URL"},
Destination: &cfg.Reva.AppProvider.AppsURL,
},
&cli.StringFlag{
Name: "appprovider-open-url",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.OpenURL, "/app/open"),
Usage: "URL where files can be handed over to an application from the app provider",
EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_OPEN_URL"},
Destination: &cfg.Reva.AppProvider.OpenURL,
},
// Reva Middlewares Config
&cli.StringSliceFlag{
Name: "user-agent-whitelist-lock-in",
Usage: "--user-agent-whitelist-lock-in=mirall:basic,foo:bearer Given a tuple of comma separated [UserAgent:challenge] values, it locks a given user agent to the authentication challenge. Particularly useful for old clients whose USer-Agent is known and only support one authentication challenge. When this flag is set in the storage-frontend it configures Reva.",
EnvVars: []string{"STORAGE_FRONTEND_MIDDLEWARE_AUTH_CREDENTIALS_BY_USER_AGENT"},
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, SharingSQLWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverEOSWithConfig(cfg)...)
return flags
}

View File

@@ -1,300 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// GatewayWithConfig applies cfg to the root flagset
func GatewayWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.DebugAddr, "127.0.0.1:9143"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_GATEWAY_DEBUG_ADDR"},
Destination: &cfg.Reva.Gateway.DebugAddr,
},
// REVA
&cli.StringFlag{
Name: "transfer-secret",
Value: flags.OverrideDefaultString(cfg.Reva.TransferSecret, "replace-me-with-a-transfer-secret"),
Usage: "Transfer secret for datagateway",
EnvVars: []string{"STORAGE_TRANSFER_SECRET"},
Destination: &cfg.Reva.TransferSecret,
},
&cli.IntFlag{
Name: "transfer-expires",
Value: flags.OverrideDefaultInt(cfg.Reva.TransferExpires, 24*60*60), // one day
Usage: "Transfer token ttl in seconds",
EnvVars: []string{"STORAGE_TRANSFER_EXPIRES"},
Destination: &cfg.Reva.TransferExpires,
},
// Services
// Gateway
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_GATEWAY_GRPC_NETWORK"},
Destination: &cfg.Reva.Gateway.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.GRPCAddr, "127.0.0.1:9142"),
Usage: "Address to bind REVA service",
EnvVars: []string{"STORAGE_GATEWAY_GRPC_ADDR"},
Destination: &cfg.Reva.Gateway.GRPCAddr,
},
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("gateway", "authregistry", "storageregistry", "appregistry"),
Usage: "--service gateway [--service authregistry]",
EnvVars: []string{"STORAGE_GATEWAY_SERVICES"},
},
&cli.BoolFlag{
Name: "commit-share-to-storage-grant",
Value: flags.OverrideDefaultBool(cfg.Reva.Gateway.CommitShareToStorageGrant, true),
Usage: "Commit shares to the share manager",
EnvVars: []string{"STORAGE_GATEWAY_COMMIT_SHARE_TO_STORAGE_GRANT"},
Destination: &cfg.Reva.Gateway.CommitShareToStorageGrant,
},
&cli.BoolFlag{
Name: "commit-share-to-storage-ref",
Value: flags.OverrideDefaultBool(cfg.Reva.Gateway.CommitShareToStorageRef, true),
Usage: "Commit shares to the storage",
EnvVars: []string{"STORAGE_GATEWAY_COMMIT_SHARE_TO_STORAGE_REF"},
Destination: &cfg.Reva.Gateway.CommitShareToStorageRef,
},
&cli.StringFlag{
Name: "share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.ShareFolder, "Shares"),
Usage: "mount shares in this folder of the home storage provider",
EnvVars: []string{"STORAGE_GATEWAY_SHARE_FOLDER"},
Destination: &cfg.Reva.Gateway.ShareFolder,
},
&cli.BoolFlag{
Name: "disable-home-creation-on-login",
Usage: "Disable creation of home folder on login",
EnvVars: []string{"STORAGE_GATEWAY_DISABLE_HOME_CREATION_ON_LOGIN"},
Destination: &cfg.Reva.Gateway.DisableHomeCreationOnLogin,
},
&cli.StringFlag{
Name: "storage-home-mapping",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.HomeMapping, ""),
Usage: "mapping template for user home paths to user-specific mount points, e.g. /home/{{substr 0 1 .Username}}",
EnvVars: []string{"STORAGE_GATEWAY_HOME_MAPPING"},
Destination: &cfg.Reva.Gateway.HomeMapping,
},
&cli.IntFlag{
Name: "etag-cache-ttl",
Value: flags.OverrideDefaultInt(cfg.Reva.Gateway.EtagCacheTTL, 0),
Usage: "TTL for the home and shares directory etags cache",
EnvVars: []string{"STORAGE_GATEWAY_ETAG_CACHE_TTL"},
Destination: &cfg.Reva.Gateway.EtagCacheTTL,
},
// other services
&cli.StringFlag{
Name: "auth-basic-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.AuthBasic.Endpoint, "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: flags.OverrideDefaultString(cfg.Reva.AuthBearer.Endpoint, "localhost:9148"),
Usage: "endpoint to use for the bearer auth provider",
EnvVars: []string{"STORAGE_AUTH_BEARER_ENDPOINT"},
Destination: &cfg.Reva.AuthBearer.Endpoint,
},
&cli.StringFlag{
Name: "auth-machine-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.AuthMachine.Endpoint, "localhost:9166"),
Usage: "endpoint to use for the machine auth provider",
EnvVars: []string{"STORAGE_AUTH_MACHINE_ENDPOINT"},
Destination: &cfg.Reva.AuthMachine.Endpoint,
},
// storage registry
&cli.StringFlag{
Name: "storage-registry-driver",
Value: flags.OverrideDefaultString(cfg.Reva.StorageRegistry.Driver, "static"),
Usage: "driver of the storage registry",
EnvVars: []string{"STORAGE_STORAGE_REGISTRY_DRIVER"},
Destination: &cfg.Reva.StorageRegistry.Driver,
},
&cli.StringSliceFlag{
Name: "storage-registry-rule",
Value: cli.NewStringSlice(),
Usage: `Replaces the generated storage registry rules with this set: --storage-registry-rule "/eos=localhost:9158" [--storage-registry-rule "1284d238-aa92-42ce-bdc4-0b0000009162=localhost:9162"]`,
EnvVars: []string{"STORAGE_STORAGE_REGISTRY_RULES"},
},
&cli.StringFlag{
Name: "storage-home-provider",
Value: flags.OverrideDefaultString(cfg.Reva.StorageRegistry.HomeProvider, "/home"),
Usage: "mount point of the storage provider for user homes in the global namespace",
EnvVars: []string{"STORAGE_STORAGE_REGISTRY_HOME_PROVIDER"},
Destination: &cfg.Reva.StorageRegistry.HomeProvider,
},
&cli.StringFlag{
Name: "storage-registry-json",
Value: flags.OverrideDefaultString(cfg.Reva.StorageRegistry.JSON, ""),
Usage: "JSON file containing the storage registry rules",
EnvVars: []string{"STORAGE_STORAGE_REGISTRY_JSON"},
Destination: &cfg.Reva.StorageRegistry.JSON,
},
// app registry
&cli.StringFlag{
Name: "app-registry-driver",
Value: flags.OverrideDefaultString(cfg.Reva.AppRegistry.Driver, "static"),
Usage: "driver of the app registry",
EnvVars: []string{"STORAGE_APP_REGISTRY_DRIVER"},
Destination: &cfg.Reva.AppRegistry.Driver,
},
&cli.StringFlag{
Name: "app-registry-mimetypes-json",
Value: flags.OverrideDefaultString(cfg.Reva.AppRegistry.MimetypesJSON, ""),
Usage: "JSON file containing the storage registry rules",
EnvVars: []string{"STORAGE_APP_REGISTRY_MIMETYPES_JSON"},
Destination: &cfg.Reva.AppRegistry.MimetypesJSON,
},
// please note that STORAGE_FRONTEND_PUBLIC_URL is also defined in
// storage/pkg/flagset/frontend.go because this setting may be consumed
// by both the gateway and frontend service
&cli.StringFlag{
Name: "public-url",
Value: flags.OverrideDefaultString(cfg.Reva.Frontend.PublicURL, "https://localhost:9200"),
Usage: "URL to use for the storage service",
EnvVars: []string{"OCIS_URL", "STORAGE_FRONTEND_PUBLIC_URL"}, // STORAGE_FRONTEND_PUBLIC_URL takes precedence over OCIS_URL
Destination: &cfg.Reva.Frontend.PublicURL,
},
&cli.StringFlag{
Name: "datagateway-url",
Value: flags.OverrideDefaultString(cfg.Reva.DataGateway.PublicURL, ""),
Usage: "URL to use for the storage datagateway, defaults to <STORAGE_FRONTEND_PUBLIC_URL>/data",
EnvVars: []string{"STORAGE_DATAGATEWAY_PUBLIC_URL"},
Destination: &cfg.Reva.DataGateway.PublicURL,
},
&cli.StringFlag{
Name: "userprovider-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Endpoint, "localhost:9144"),
Usage: "endpoint to use for the userprovider",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
&cli.StringFlag{
Name: "groupprovider-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.Endpoint, "localhost:9160"),
Usage: "endpoint to use for the groupprovider",
EnvVars: []string{"STORAGE_GROUPPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Groups.Endpoint,
},
&cli.StringFlag{
Name: "sharing-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.Endpoint, "localhost:9150"),
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_ENDPOINT"},
Destination: &cfg.Reva.Sharing.Endpoint,
},
&cli.StringFlag{
Name: "appprovider-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.Endpoint, "localhost:9164"),
Usage: "endpoint to use for the app provider",
EnvVars: []string{"STORAGE_APPPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.AppProvider.Endpoint,
},
// register home storage
&cli.StringFlag{
Name: "storage-home-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.Endpoint, "localhost:9154"),
Usage: "endpoint to use for the home storage",
EnvVars: []string{"STORAGE_HOME_ENDPOINT"},
Destination: &cfg.Reva.StorageHome.Endpoint,
},
&cli.StringFlag{
Name: "storage-home-mount-path",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.MountPath, "/home"),
Usage: "mount path",
EnvVars: []string{"STORAGE_HOME_MOUNT_PATH"},
Destination: &cfg.Reva.StorageHome.MountPath,
},
&cli.StringFlag{
Name: "storage-home-mount-id",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.MountID, "1284d238-aa92-42ce-bdc4-0b0000009154"),
Usage: "mount id",
EnvVars: []string{"STORAGE_HOME_MOUNT_ID"},
Destination: &cfg.Reva.StorageHome.MountID,
},
// register users storage
&cli.StringFlag{
Name: "storage-users-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.StorageUsers.Endpoint, "localhost:9157"),
Usage: "endpoint to use for the users storage",
EnvVars: []string{"STORAGE_USERS_ENDPOINT"},
Destination: &cfg.Reva.StorageUsers.Endpoint,
},
&cli.StringFlag{
Name: "storage-users-mount-path",
Value: flags.OverrideDefaultString(cfg.Reva.StorageUsers.MountPath, "/users"),
Usage: "mount path",
EnvVars: []string{"STORAGE_USERS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageUsers.MountPath,
},
&cli.StringFlag{
Name: "storage-users-mount-id",
Value: flags.OverrideDefaultString(cfg.Reva.StorageUsers.MountID, "1284d238-aa92-42ce-bdc4-0b0000009157"),
Usage: "mount id",
EnvVars: []string{"STORAGE_USERS_MOUNT_ID"},
Destination: &cfg.Reva.StorageUsers.MountID,
},
// register public link storage
&cli.StringFlag{
Name: "public-link-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.StoragePublicLink.Endpoint, "localhost:9178"),
Usage: "endpoint to use for the public links service",
EnvVars: []string{"STORAGE_PUBLIC_LINK_ENDPOINT"},
Destination: &cfg.Reva.StoragePublicLink.Endpoint,
},
&cli.StringFlag{
Name: "storage-public-link-mount-path",
Value: flags.OverrideDefaultString(cfg.Reva.StoragePublicLink.MountPath, "/public"),
Usage: "mount path",
EnvVars: []string{"STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
},
// public-link has no mount id
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,94 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// GroupsWithConfig applies cfg to the root flagset
func GroupsWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.DebugAddr, "127.0.0.1:9161"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_GROUPPROVIDER_DEBUG_ADDR"},
Destination: &cfg.Reva.Groups.DebugAddr,
},
// Services
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// Groupprovider
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_GROUPPROVIDER_NETWORK"},
Destination: &cfg.Reva.Groups.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.GRPCAddr, "127.0.0.1:9160"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_GROUPPROVIDER_ADDR"},
Destination: &cfg.Reva.Groups.GRPCAddr,
},
&cli.StringFlag{
Name: "endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.Endpoint, "localhost:9160"),
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_GROUPPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Groups.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("groupprovider"), // TODO preferences
Usage: "--service groupprovider [--service otherservice]",
EnvVars: []string{"STORAGE_GROUPPROVIDER_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.Driver, "ldap"),
Usage: "group driver: 'json', 'ldap', or 'rest'",
EnvVars: []string{"STORAGE_GROUPPROVIDER_DRIVER"},
Destination: &cfg.Reva.Groups.Driver,
},
&cli.StringFlag{
Name: "json-config",
Value: flags.OverrideDefaultString(cfg.Reva.Groups.JSON, ""),
Usage: "Path to groups.json file",
EnvVars: []string{"STORAGE_GROUPPROVIDER_JSON"},
Destination: &cfg.Reva.Groups.JSON,
},
&cli.IntFlag{
Name: "group-members-cache-expiration",
Value: flags.OverrideDefaultInt(cfg.Reva.Groups.GroupMembersCacheExpiration, 5),
Usage: "Time in minutes for redis cache expiration.",
EnvVars: []string{"STORAGE_GROUP_CACHE_EXPIRATION"},
Destination: &cfg.Reva.Groups.GroupMembersCacheExpiration,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, LDAPWithConfig(cfg)...)
flags = append(flags, RestWithConfig(cfg)...)
return flags
}

View File

@@ -1,20 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// HealthWithConfig applies cfg to the health flagset
func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "127.0.0.1:9109"),
Usage: "Address to debug endpoint",
EnvVars: []string{"STORAGE_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
},
}
}

View File

@@ -1,229 +0,0 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// LDAPWithConfig applies LDAP cfg to the flagset
func LDAPWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "ldap-hostname",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.Hostname, "localhost"),
Usage: "LDAP hostname",
EnvVars: []string{"STORAGE_LDAP_HOSTNAME"},
Destination: &cfg.Reva.LDAP.Hostname,
},
&cli.IntFlag{
Name: "ldap-port",
Value: flags.OverrideDefaultInt(cfg.Reva.LDAP.Port, 9126),
Usage: "LDAP port",
EnvVars: []string{"STORAGE_LDAP_PORT"},
Destination: &cfg.Reva.LDAP.Port,
},
&cli.StringFlag{
Name: "ldap-cacert",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.CACert, path.Join(defaults.BaseDataPath(), "ldap", "ldap.crt")),
Usage: "Path to a trusted Certificate file (in PEM format) for the LDAP Connection",
EnvVars: []string{"STORAGE_LDAP_CACERT"},
Destination: &cfg.Reva.LDAP.CACert,
},
&cli.BoolFlag{
Name: "ldap-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.LDAP.Insecure, false),
Usage: "Disable TLS certificate and hostname validation",
EnvVars: []string{"STORAGE_LDAP_INSECURE"},
Destination: &cfg.Reva.LDAP.Insecure,
},
&cli.StringFlag{
Name: "ldap-base-dn",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.BaseDN, "dc=ocis,dc=test"),
Usage: "LDAP basedn",
EnvVars: []string{"STORAGE_LDAP_BASE_DN"},
Destination: &cfg.Reva.LDAP.BaseDN,
},
&cli.StringFlag{
Name: "ldap-loginfilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.LoginFilter, "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))"),
Usage: "LDAP login filter",
EnvVars: []string{"STORAGE_LDAP_LOGINFILTER"},
Destination: &cfg.Reva.LDAP.LoginFilter,
},
// User specific filters
&cli.StringFlag{
Name: "ldap-userfilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserFilter, "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))"),
Usage: "LDAP filter used when getting a user. The CS3 userid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"STORAGE_LDAP_USERFILTER"},
Destination: &cfg.Reva.LDAP.UserFilter,
},
&cli.StringFlag{
Name: "ldap-userattributefilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserAttributeFilter, "(&(objectclass=posixAccount)({{attr}}={{value}}))"),
Usage: "LDAP filter used when searching for a user by claim/attribute. {{attr}} will be replaced with the attribute, {{value}} with the value.",
EnvVars: []string{"STORAGE_LDAP_USERATTRIBUTEFILTER"},
Destination: &cfg.Reva.LDAP.UserAttributeFilter,
},
&cli.StringFlag{
Name: "ldap-userfindfilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserFindFilter, "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))"),
Usage: "LDAP filter used when searching for user recipients. {{query}} will be replaced with the search query",
EnvVars: []string{"STORAGE_LDAP_USERFINDFILTER"},
Destination: &cfg.Reva.LDAP.UserFindFilter,
},
&cli.StringFlag{
Name: "ldap-usergroupfilter",
// FIXME the storage implementation needs to use the memberof overlay to get the cn when it only has the uuid,
// because the ldap schema either uses the dn or the member(of) attributes to establish membership
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserGroupFilter, "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))"), // This filter will never work
Usage: "LDAP filter used when getting the groups of a user. The CS3 userid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"STORAGE_LDAP_USERGROUPFILTER"},
Destination: &cfg.Reva.LDAP.UserGroupFilter,
},
// Group specific filters
// These might not work at the moment. Need to be fixed
&cli.StringFlag{
Name: "ldap-groupfilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupFilter, "(&(objectclass=posixGroup)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))"),
Usage: "LDAP filter used when getting a group. The CS3 groupid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"STORAGE_LDAP_GROUPFILTER"},
Destination: &cfg.Reva.LDAP.GroupFilter,
},
&cli.StringFlag{
Name: "ldap-groupattributefilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupAttributeFilter, "(&(objectclass=posixGroup)({{attr}}={{value}}))"),
Usage: "LDAP filter used when searching for a group by claim/attribute. {{attr}} will be replaced with the attribute, {{value}} with the value.",
EnvVars: []string{"STORAGE_LDAP_GROUPATTRIBUTEFILTER"},
Destination: &cfg.Reva.LDAP.GroupAttributeFilter,
},
&cli.StringFlag{
Name: "ldap-groupfindfilter",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupFindFilter, "(&(objectclass=posixGroup)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))"),
Usage: "LDAP filter used when searching for group recipients. {{query}} will be replaced with the search query",
EnvVars: []string{"STORAGE_LDAP_GROUPFINDFILTER"},
Destination: &cfg.Reva.LDAP.GroupFindFilter,
},
&cli.StringFlag{
Name: "ldap-groupmemberfilter",
// FIXME the storage implementation needs to use the members overlay to get the cn when it only has the uuid
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupMemberFilter, "(&(objectclass=posixAccount)(ownclouduuid={{.OpaqueId}}*))"), // This filter will never work
Usage: "LDAP filter used when getting the members of a group. The CS3 groupid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"STORAGE_LDAP_GROUPMEMBERFILTER"},
Destination: &cfg.Reva.LDAP.GroupMemberFilter,
},
&cli.StringFlag{
Name: "ldap-bind-dn",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.BindDN, "cn=reva,ou=sysusers,dc=ocis,dc=test"),
Usage: "LDAP bind dn",
EnvVars: []string{"STORAGE_LDAP_BIND_DN"},
Destination: &cfg.Reva.LDAP.BindDN,
},
&cli.StringFlag{
Name: "ldap-bind-password",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.BindPassword, "reva"),
Usage: "LDAP bind password",
EnvVars: []string{"STORAGE_LDAP_BIND_PASSWORD"},
Destination: &cfg.Reva.LDAP.BindPassword,
},
&cli.StringFlag{
Name: "ldap-idp",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.IDP, "https://localhost:9200"),
Usage: "Identity provider to use for users",
EnvVars: []string{"STORAGE_LDAP_IDP", "OCIS_URL"}, // STORAGE_LDAP_IDP takes precedence over OCIS_URL
Destination: &cfg.Reva.LDAP.IDP,
},
// ldap dn is always the dn
// user schema
&cli.StringFlag{
Name: "ldap-user-schema-uid",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserSchema.UID, "ownclouduuid"),
Usage: "LDAP user schema uid",
EnvVars: []string{"STORAGE_LDAP_USER_SCHEMA_UID"},
Destination: &cfg.Reva.LDAP.UserSchema.UID,
},
&cli.StringFlag{
Name: "ldap-user-schema-mail",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserSchema.Mail, "mail"),
Usage: "LDAP user schema mail",
EnvVars: []string{"STORAGE_LDAP_USER_SCHEMA_MAIL"},
Destination: &cfg.Reva.LDAP.UserSchema.Mail,
},
&cli.StringFlag{
Name: "ldap-user-schema-displayName",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserSchema.DisplayName, "displayname"),
Usage: "LDAP user schema displayName",
EnvVars: []string{"STORAGE_LDAP_USER_SCHEMA_DISPLAYNAME"},
Destination: &cfg.Reva.LDAP.UserSchema.DisplayName,
},
&cli.StringFlag{
Name: "ldap-user-schema-cn",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserSchema.CN, "cn"),
Usage: "LDAP user schema cn",
EnvVars: []string{"STORAGE_LDAP_USER_SCHEMA_CN"},
Destination: &cfg.Reva.LDAP.UserSchema.CN,
},
&cli.StringFlag{
Name: "ldap-user-schema-uidnumber",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserSchema.UIDNumber, "uidnumber"),
Usage: "LDAP user schema uidnumber",
EnvVars: []string{"STORAGE_LDAP_USER_SCHEMA_UID_NUMBER"},
Destination: &cfg.Reva.LDAP.UserSchema.UIDNumber,
},
&cli.StringFlag{
Name: "ldap-user-schema-gidnumber",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.UserSchema.GIDNumber, "gidnumber"),
Usage: "LDAP user schema gidnumber",
EnvVars: []string{"STORAGE_LDAP_USER_SCHEMA_GID_NUMBER"},
Destination: &cfg.Reva.LDAP.UserSchema.GIDNumber,
},
// group schema
&cli.StringFlag{
Name: "ldap-group-schema-gid",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupSchema.GID, "cn"),
Usage: "LDAP group schema gid",
EnvVars: []string{"STORAGE_LDAP_GROUP_SCHEMA_GID"},
Destination: &cfg.Reva.LDAP.GroupSchema.GID,
},
&cli.StringFlag{
Name: "ldap-group-schema-mail",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupSchema.Mail, "mail"),
Usage: "LDAP group schema mail",
EnvVars: []string{"STORAGE_LDAP_GROUP_SCHEMA_MAIL"},
Destination: &cfg.Reva.LDAP.GroupSchema.Mail,
},
&cli.StringFlag{
Name: "ldap-group-schema-displayName",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupSchema.DisplayName, "cn"),
Usage: "LDAP group schema displayName",
EnvVars: []string{"STORAGE_LDAP_GROUP_SCHEMA_DISPLAYNAME"},
Destination: &cfg.Reva.LDAP.GroupSchema.DisplayName,
},
&cli.StringFlag{
Name: "ldap-group-schema-cn",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupSchema.CN, "cn"),
Usage: "LDAP group schema cn",
EnvVars: []string{"STORAGE_LDAP_GROUP_SCHEMA_CN"},
Destination: &cfg.Reva.LDAP.GroupSchema.CN,
},
&cli.StringFlag{
Name: "ldap-group-schema-gidnumber",
Value: flags.OverrideDefaultString(cfg.Reva.LDAP.GroupSchema.GIDNumber, "gidnumber"),
Usage: "LDAP group schema gidnumber",
EnvVars: []string{"STORAGE_LDAP_GROUP_SCHEMA_GID_NUMBER"},
Destination: &cfg.Reva.LDAP.GroupSchema.GIDNumber,
},
}
}

View File

@@ -1,136 +0,0 @@
package metadatadrivers
import (
"os"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverEOSWithConfig applies cfg to the root flagset
func DriverEOSWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-eos-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.Root, "/eos/dockertest/reva"),
Usage: "Namespace for metadata operations",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_NAMESPACE"},
Destination: &cfg.Reva.MetadataStorage.EOS.Root,
},
&cli.StringFlag{
Name: "storage-eos-shadow-namespace",
// Defaults to path.Join(c.Namespace, ".shadow")
Usage: "Shadow namespace where share references are stored",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHADOW_NAMESPACE"},
Destination: &cfg.Reva.MetadataStorage.EOS.ShadowNamespace,
},
&cli.StringFlag{
Name: "storage-eos-uploads-namespace",
// Defaults to path.Join(c.Namespace, ".uploads")
Usage: "Uploads namespace",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_UPLOADS_NAMESPACE"},
Destination: &cfg.Reva.MetadataStorage.EOS.UploadsNamespace,
},
&cli.StringFlag{
Name: "storage-eos-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.ShareFolder, "/Shares"),
Usage: "name of the share folder",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHARE_FOLDER"},
Destination: &cfg.Reva.MetadataStorage.EOS.ShareFolder,
},
&cli.StringFlag{
Name: "storage-eos-binary",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.EosBinary, "/usr/bin/eos"),
Usage: "Location of the eos binary",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_BINARY"},
Destination: &cfg.Reva.MetadataStorage.EOS.EosBinary,
},
&cli.StringFlag{
Name: "storage-eos-xrdcopy-binary",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.XrdcopyBinary, "/usr/bin/xrdcopy"),
Usage: "Location of the xrdcopy binary",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_XRDCOPY_BINARY"},
Destination: &cfg.Reva.MetadataStorage.EOS.XrdcopyBinary,
},
&cli.StringFlag{
Name: "storage-eos-master-url",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.MasterURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Master EOS MGM",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_MASTER_URL"},
Destination: &cfg.Reva.MetadataStorage.EOS.MasterURL,
},
&cli.StringFlag{
Name: "storage-eos-slave-url",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.SlaveURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Slave EOS MGM",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SLAVE_URL"},
Destination: &cfg.Reva.MetadataStorage.EOS.SlaveURL,
},
&cli.StringFlag{
Name: "storage-eos-cache-directory",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.CacheDirectory, os.TempDir()),
Usage: "Location on the local fs where to store reads",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_CACHE_DIRECTORY"},
Destination: &cfg.Reva.MetadataStorage.EOS.CacheDirectory,
},
&cli.BoolFlag{
Name: "storage-eos-enable-logging",
Usage: "Enables logging of the commands executed",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_ENABLE_LOGGING"},
Destination: &cfg.Reva.MetadataStorage.EOS.EnableLogging,
},
&cli.BoolFlag{
Name: "storage-eos-show-hidden-sysfiles",
Usage: "show internal EOS files like .sys.v# and .sys.a# files.",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHOW_HIDDEN_SYSFILES"},
Destination: &cfg.Reva.MetadataStorage.EOS.ShowHiddenSysFiles,
},
&cli.BoolFlag{
Name: "storage-eos-force-singleuser-mode",
Usage: "force connections to EOS to use SingleUsername",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_FORCE_SINGLEUSER_MODE"},
Destination: &cfg.Reva.MetadataStorage.EOS.ForceSingleUserMode,
},
&cli.BoolFlag{
Name: "storage-eos-use-keytab",
Usage: "authenticate requests by using an EOS keytab",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_USE_KEYTAB"},
Destination: &cfg.Reva.MetadataStorage.EOS.UseKeytab,
},
&cli.StringFlag{
Name: "storage-eos-sec-protocol",
Usage: "the xrootd security protocol to use between the server and EOS",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SEC_PROTOCOL"},
Destination: &cfg.Reva.MetadataStorage.EOS.SecProtocol,
},
&cli.StringFlag{
Name: "storage-eos-keytab",
Usage: "the location of the keytab to use to authenticate to EOS",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_KEYTAB"},
Destination: &cfg.Reva.MetadataStorage.EOS.Keytab,
},
&cli.StringFlag{
Name: "storage-eos-single-username",
Usage: "the username to use when SingleUserMode is enabled",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SINGLE_USERNAME"},
Destination: &cfg.Reva.MetadataStorage.EOS.SingleUsername,
},
&cli.StringFlag{
Name: "storage-eos-layout",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.UserLayout, "{{substr 0 1 .Username}}/{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.EOS.UserLayout,
},
&cli.StringFlag{
Name: "storage-eos-reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.EOS.GatewaySVC, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.MetadataStorage.EOS.GatewaySVC,
},
}
}

View File

@@ -1,23 +0,0 @@
package metadatadrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverLocalWithConfig applies cfg to the root flagset
func DriverLocalWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-local-root",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.Local.Root, path.Join(defaults.BaseDataPath(), "storage", "local", "metadata")),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_METADATA_DRIVER_LOCAL_ROOT"},
Destination: &cfg.Reva.MetadataStorage.Local.Root,
},
}
}

View File

@@ -1,37 +0,0 @@
package metadatadrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOCISWithConfig applies cfg to the root flagset
func DriverOCISWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-ocis-root",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OCIS.Root, path.Join(defaults.BaseDataPath(), "storage", "metadata")),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_ROOT"},
Destination: &cfg.Reva.MetadataStorage.OCIS.Root,
},
&cli.StringFlag{
Name: "storage-ocis-layout",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OCIS.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.OCIS.UserLayout,
},
&cli.StringFlag{
Name: "service-user-uuid",
Value: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
Usage: "uuid of the internal service user",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_SERVICE_USER_UUID"},
Destination: &cfg.Reva.MetadataStorage.OCIS.ServiceUserUUID,
},
}
}

View File

@@ -1,48 +0,0 @@
package metadatadrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverS3NGWithConfig applies cfg to the root flagset
func DriverS3WithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-s3-region",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.S3.Region, "default"),
Usage: `"the s3 region" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_REGION"},
Destination: &cfg.Reva.MetadataStorage.S3.Region,
},
&cli.StringFlag{
Name: "storage-s3-accesskey",
Value: "",
Usage: `"the s3 access key" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_ACCESS_KEY"},
Destination: &cfg.Reva.MetadataStorage.S3.AccessKey,
},
&cli.StringFlag{
Name: "storage-s3-secretkey",
Value: "",
Usage: `"the secret s3 api key" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_SECRET_KEY"},
Destination: &cfg.Reva.MetadataStorage.S3.SecretKey,
},
&cli.StringFlag{
Name: "storage-s3-endpoint",
Value: "",
Usage: `"s3 compatible API endpoint" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_ENDPOINT"},
Destination: &cfg.Reva.MetadataStorage.S3.Endpoint,
},
&cli.StringFlag{
Name: "storage-s3-bucket",
Value: "",
Usage: `"bucket where the data will be stored in`,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3_BUCKET"},
Destination: &cfg.Reva.MetadataStorage.S3.Bucket,
},
}
}

View File

@@ -1,65 +0,0 @@
package metadatadrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverS3NGWithConfig applies cfg to the root flagset
func DriverS3NGWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-s3ng-root",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.S3NG.Root, path.Join(defaults.BaseDataPath(), "storage", "metadata")),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ROOT"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Root,
},
&cli.StringFlag{
Name: "storage-s3ng-layout",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.S3NG.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.S3NG.UserLayout,
},
&cli.StringFlag{
Name: "storage-s3ng-region",
Value: "default",
Usage: `"the s3 region" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_REGION"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Region,
},
&cli.StringFlag{
Name: "storage-s3ng-accesskey",
Value: "",
Usage: `"the s3 access key" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ACCESS_KEY"},
Destination: &cfg.Reva.MetadataStorage.S3NG.AccessKey,
},
&cli.StringFlag{
Name: "storage-s3ng-secretkey",
Value: "",
Usage: `"the secret s3 api key" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_SECRET_KEY"},
Destination: &cfg.Reva.MetadataStorage.S3NG.SecretKey,
},
&cli.StringFlag{
Name: "storage-s3ng-endpoint",
Value: "",
Usage: `"s3 compatible API endpoint" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ENDPOINT"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Endpoint,
},
&cli.StringFlag{
Name: "storage-s3ng-bucket",
Value: "",
Usage: `"bucket where the data will be stored in`,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_BUCKET"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Bucket,
},
}
}

View File

@@ -1,76 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// RestWithConfig applies REST user/group provider cfg to the flagset
func RestWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "rest-client-id",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.ClientID, ""),
Usage: "User/group rest driver Client ID",
EnvVars: []string{"STORAGE_REST_CLIENT_ID"},
Destination: &cfg.Reva.UserGroupRest.ClientID,
},
&cli.StringFlag{
Name: "rest-client-secret",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.ClientSecret, ""),
Usage: "User/group rest driver Client Secret",
EnvVars: []string{"STORAGE_REST_CLIENT_SECRET"},
Destination: &cfg.Reva.UserGroupRest.ClientSecret,
},
&cli.StringFlag{
Name: "rest-redis-address",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.RedisAddress, "localhost:6379"),
Usage: "Address for redis server",
EnvVars: []string{"STORAGE_REST_REDIS_ADDRESS"},
Destination: &cfg.Reva.UserGroupRest.RedisAddress,
},
&cli.StringFlag{
Name: "rest-redis-username",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.RedisUsername, ""),
Usage: "Username for redis server",
EnvVars: []string{"STORAGE_REST_REDIS_USERNAME"},
Destination: &cfg.Reva.UserGroupRest.RedisUsername,
},
&cli.StringFlag{
Name: "rest-redis-password",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.RedisPassword, ""),
Usage: "Password for redis server",
EnvVars: []string{"STORAGE_REST_REDIS_PASSWORD"},
Destination: &cfg.Reva.UserGroupRest.RedisPassword,
},
&cli.StringFlag{
Name: "rest-id-provider",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.IDProvider, ""),
Usage: "The OIDC Provider",
EnvVars: []string{"STORAGE_REST_ID_PROVIDER"},
Destination: &cfg.Reva.UserGroupRest.IDProvider,
},
&cli.StringFlag{
Name: "rest-api-base-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.APIBaseURL, ""),
Usage: "Base API Endpoint",
EnvVars: []string{"STORAGE_REST_API_BASE_URL"},
Destination: &cfg.Reva.UserGroupRest.APIBaseURL,
},
&cli.StringFlag{
Name: "rest-oidc-token-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.OIDCTokenEndpoint, ""),
Usage: "Endpoint to generate token to access the API",
EnvVars: []string{"STORAGE_REST_OIDC_TOKEN_ENDPOINT"},
Destination: &cfg.Reva.UserGroupRest.OIDCTokenEndpoint,
},
&cli.StringFlag{
Name: "rest-target-api",
Value: flags.OverrideDefaultString(cfg.Reva.UserGroupRest.TargetAPI, ""),
Usage: "The target application",
EnvVars: []string{"STORAGE_REST_TARGET_API"},
Destination: &cfg.Reva.UserGroupRest.TargetAPI,
},
}
}

View File

@@ -1,37 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// RootWithConfig applies cfg to the root flagset
func RootWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "config-file",
Value: "",
Usage: "Path to config file",
EnvVars: []string{"STORAGE_CONFIG_FILE"},
Destination: &cfg.File,
},
&cli.StringFlag{
Name: "log-level",
Usage: "Set logging level",
EnvVars: []string{"OCIS_LOG_LEVEL", "STORAGE_LOG_LEVEL"},
Destination: &cfg.Log.Level,
},
&cli.BoolFlag{
Name: "log-pretty",
Usage: "Enable pretty logging",
EnvVars: []string{"OCIS_LOG_PRETTY", "STORAGE_LOG_PRETTY"},
Destination: &cfg.Log.Pretty,
},
&cli.BoolFlag{
Name: "log-color",
Usage: "Enable colored logging",
EnvVars: []string{"OCIS_LOG_COLOR", "STORAGE_LOG_COLOR"},
Destination: &cfg.Log.Color,
},
}
}

View File

@@ -1,27 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// SecretWithConfig applies cfg to the root flagset
func SecretWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "jwt-secret",
Value: flags.OverrideDefaultString(cfg.Reva.JWTSecret, "Pive-Fumkiu4"),
Usage: "Shared jwt secret for reva service communication",
EnvVars: []string{"STORAGE_JWT_SECRET", "OCIS_JWT_SECRET"},
Destination: &cfg.Reva.JWTSecret,
},
&cli.BoolFlag{
Name: "skip-user-groups-in-token",
Value: flags.OverrideDefaultBool(cfg.Reva.SkipUserGroupsInToken, false),
Usage: "Whether to skip encoding user groups in reva's JWT token",
EnvVars: []string{"STORAGE_SKIP_USER_GROUPS_IN_TOKEN"},
Destination: &cfg.Reva.SkipUserGroupsInToken,
},
}
}

View File

@@ -1,116 +0,0 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// SharingWithConfig applies cfg to the root flagset
func SharingWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.DebugAddr, "127.0.0.1:9151"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_SHARING_DEBUG_ADDR"},
Destination: &cfg.Reva.Sharing.DebugAddr,
},
// Services
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// Sharing
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_SHARING_GRPC_NETWORK"},
Destination: &cfg.Reva.Sharing.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.GRPCAddr, "127.0.0.1:9150"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_SHARING_GRPC_ADDR"},
Destination: &cfg.Reva.Sharing.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("usershareprovider", "publicshareprovider"), // accounted for
Usage: "--service usershareprovider [--service publicshareprovider]",
EnvVars: []string{"STORAGE_SHARING_SERVICES"},
},
&cli.StringFlag{
Name: "user-driver",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserDriver, "json"),
Usage: "driver to use for the UserShareProvider",
EnvVars: []string{"STORAGE_SHARING_USER_DRIVER"},
Destination: &cfg.Reva.Sharing.UserDriver,
},
&cli.StringFlag{
Name: "user-json-file",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserJSONFile, path.Join(defaults.BaseDataPath(), "storage", "shares.json")),
Usage: "file used to persist shares for the UserShareProvider",
EnvVars: []string{"STORAGE_SHARING_USER_JSON_FILE"},
Destination: &cfg.Reva.Sharing.UserJSONFile,
},
&cli.StringFlag{
Name: "public-driver",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.PublicDriver, "json"),
Usage: "driver to use for the PublicShareProvider",
EnvVars: []string{"STORAGE_SHARING_PUBLIC_DRIVER"},
Destination: &cfg.Reva.Sharing.PublicDriver,
},
&cli.StringFlag{
Name: "public-json-file",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.PublicJSONFile, path.Join(defaults.BaseDataPath(), "storage", "publicshares.json")),
Usage: "file used to persist shares for the PublicShareProvider",
EnvVars: []string{"STORAGE_SHARING_PUBLIC_JSON_FILE"},
Destination: &cfg.Reva.Sharing.PublicJSONFile,
},
&cli.IntFlag{
Name: "public-password-hash-cost",
Value: flags.OverrideDefaultInt(cfg.Reva.Sharing.PublicPasswordHashCost, 11),
Usage: "the cost of hashing the public shares passwords",
EnvVars: []string{"STORAGE_SHARING_PUBLIC_PASSWORD_HASH_COST"},
Destination: &cfg.Reva.Sharing.PublicPasswordHashCost,
},
&cli.BoolFlag{
Name: "public-enable-expired-shares-cleanup",
Value: flags.OverrideDefaultBool(cfg.Reva.Sharing.PublicEnableExpiredSharesCleanup, true),
Usage: "whether to periodically delete expired public shares",
EnvVars: []string{"STORAGE_SHARING_PUBLIC_ENABLE_EXPIRED_SHARES_CLEANUP"},
Destination: &cfg.Reva.Sharing.PublicEnableExpiredSharesCleanup,
},
&cli.IntFlag{
Name: "public-janitor-run-interval",
Value: flags.OverrideDefaultInt(cfg.Reva.Sharing.PublicJanitorRunInterval, 60),
Usage: "the time period in seconds after which to start a janitor run",
EnvVars: []string{"STORAGE_SHARING_PUBLIC_JANITOR_RUN_INTERVAL"},
Destination: &cfg.Reva.Sharing.PublicJanitorRunInterval,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, SharingSQLWithConfig(cfg)...)
return flags
}

View File

@@ -1,48 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// SharingSQLWithConfig applies the Sharing SQL driver cfg to the flagset
func SharingSQLWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "user-sql-username",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserSQLUsername, ""),
Usage: "Username to be used to connect to the SQL database",
EnvVars: []string{"STORAGE_SHARING_USER_SQL_USERNAME"},
Destination: &cfg.Reva.Sharing.UserSQLUsername,
},
&cli.StringFlag{
Name: "user-sql-password",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserSQLPassword, ""),
Usage: "Password to be used to connect to the SQL database",
EnvVars: []string{"STORAGE_SHARING_USER_SQL_PASSWORD"},
Destination: &cfg.Reva.Sharing.UserSQLPassword,
},
&cli.StringFlag{
Name: "user-sql-host",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserSQLHost, ""),
Usage: "Hostname of the SQL database",
EnvVars: []string{"STORAGE_SHARING_USER_SQL_HOST"},
Destination: &cfg.Reva.Sharing.UserSQLHost,
},
&cli.IntFlag{
Name: "user-sql-port",
Value: flags.OverrideDefaultInt(cfg.Reva.Sharing.UserSQLPort, 1433),
Usage: "The port on which the SQL database is exposed",
EnvVars: []string{"STORAGE_SHARING_USER_SQL_PORT"},
Destination: &cfg.Reva.Sharing.UserSQLPort,
},
&cli.StringFlag{
Name: "user-sql-name",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserSQLName, ""),
Usage: "Name of the SQL database",
EnvVars: []string{"STORAGE_SHARING_USER_SQL_NAME"},
Destination: &cfg.Reva.Sharing.UserSQLName,
},
}
}

View File

@@ -1,175 +0,0 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/userdrivers"
"github.com/urfave/cli/v2"
)
// StorageHomeWithConfig applies cfg to the root flagset
func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.DebugAddr, "127.0.0.1:9156"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_HOME_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageHome.DebugAddr,
},
// Services
// Storage home
&cli.StringFlag{
Name: "grpc-network",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_HOME_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageHome.GRPCNetwork,
},
&cli.StringFlag{
Name: "grpc-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.GRPCAddr, "127.0.0.1:9154"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_HOME_GRPC_ADDR"},
Destination: &cfg.Reva.StorageHome.GRPCAddr,
},
&cli.StringFlag{
Name: "http-network",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.HTTPNetwork, "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.StringFlag{
Name: "http-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.HTTPAddr, "127.0.0.1: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: flags.OverrideDefaultString(cfg.Reva.StorageHome.Driver, "ocis"),
Usage: "storage driver for home mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_HOME_DRIVER"},
Destination: &cfg.Reva.StorageHome.Driver,
},
&cli.BoolFlag{
Name: "read-only",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageHome.ReadOnly, false),
Usage: "use storage driver in read-only mode",
EnvVars: []string{"STORAGE_HOME_READ_ONLY", "OCIS_STORAGE_READ_ONLY"},
Destination: &cfg.Reva.StorageHome.ReadOnly,
},
&cli.StringFlag{
Name: "mount-path",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.MountPath, "/home"),
Usage: "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 without home enabled.
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.MountID, "1284d238-aa92-42ce-bdc4-0b0000009157"),
Usage: "mount id",
EnvVars: []string{"STORAGE_HOME_MOUNT_ID"},
Destination: &cfg.Reva.StorageHome.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageHome.ExposeDataServer, false),
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_HOME_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageHome.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.DataServerURL, "http://localhost:9155/data"),
Usage: "data server url",
EnvVars: []string{"STORAGE_HOME_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageHome.DataServerURL,
},
&cli.StringFlag{
Name: "http-prefix",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.HTTPPrefix, "data"),
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_HOME_HTTP_PREFIX"},
Destination: &cfg.Reva.StorageHome.HTTPPrefix,
},
&cli.StringFlag{
Name: "tmp-folder",
Value: flags.OverrideDefaultString(cfg.Reva.StorageHome.TempFolder, path.Join(defaults.BaseDataPath(), "tmp", "home")),
Usage: "path to tmp folder",
EnvVars: []string{"STORAGE_HOME_TMP_FOLDER"},
Destination: &cfg.Reva.StorageHome.TempFolder,
},
&cli.BoolFlag{
Name: "dataprovider-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageHome.DataProvider.Insecure, false),
Usage: "dataprovider insecure",
EnvVars: []string{"STORAGE_HOME_DATAPROVIDER_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.StorageHome.DataProvider.Insecure,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "users-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Endpoint, "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, userdrivers.DriverEOSWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverLocalWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudSQLWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOCISWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverS3NGWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverS3WithConfig(cfg)...)
return flags
}

View File

@@ -1,114 +0,0 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/metadatadrivers"
"github.com/urfave/cli/v2"
)
// StorageMetadata applies cfg to the root flagset
func StorageMetadata(cfg *config.Config) []cli.Flag {
f := []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.DebugAddr, "127.0.0.1:9217"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_METADATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageMetadata.DebugAddr,
},
&cli.StringFlag{
Name: "grpc-network",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_METADATA_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.GRPCNetwork,
},
&cli.StringFlag{
Name: "grpc-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.GRPCAddr, "127.0.0.1:9215"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_METADATA_GRPC_PROVIDER_ADDR"},
Destination: &cfg.Reva.StorageMetadata.GRPCAddr,
},
&cli.StringFlag{
Name: "data-server-url",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.DataServerURL, "http://localhost:9216"),
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: "http-network",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.HTTPNetwork, "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: "http-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.HTTPAddr, "127.0.0.1:9216"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_METADATA_HTTP_ADDR"},
Destination: &cfg.Reva.StorageMetadata.HTTPAddr,
},
&cli.StringFlag{
Name: "tmp-folder",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.TempFolder, path.Join(defaults.BaseDataPath(), "tmp", "metadata")),
Usage: "path to tmp folder",
EnvVars: []string{"STORAGE_METADATA_TMP_FOLDER"},
Destination: &cfg.Reva.StorageMetadata.TempFolder,
},
&cli.StringFlag{
Name: "driver",
Value: flags.OverrideDefaultString(cfg.Reva.StorageMetadata.Driver, "ocis"),
Usage: "storage driver for metadata mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_METADATA_DRIVER"},
Destination: &cfg.Reva.StorageMetadata.Driver,
},
&cli.BoolFlag{
Name: "dataprovider-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageMetadata.DataProvider.Insecure, false),
Usage: "dataprovider insecure",
EnvVars: []string{"STORAGE_METADATA_DATAPROVIDER_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.StorageMetadata.DataProvider.Insecure,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "userprovider-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Endpoint, "localhost:9144"),
Usage: "endpoint to use for the userprovider service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
f = append(f, TracingWithConfig(cfg)...)
f = append(f, DebugWithConfig(cfg)...)
f = append(f, SecretWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverEOSWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverLocalWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverOCISWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverS3NGWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverS3WithConfig(cfg)...)
return f
}

View File

@@ -1,58 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// StoragePublicLink applies cfg to the root flagset
func StoragePublicLink(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.StoragePublicLink.DebugAddr, "127.0.0.1:9179"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_PUBLIC_LINK_DEBUG_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.DebugAddr,
},
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.StoragePublicLink.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_NETWORK"},
Destination: &cfg.Reva.StoragePublicLink.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.StoragePublicLink.GRPCAddr, "127.0.0.1:9178"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.GRPCAddr,
},
&cli.StringFlag{
Name: "mount-path",
Value: flags.OverrideDefaultString(cfg.Reva.StoragePublicLink.MountPath, "/public"),
Usage: "mount path",
EnvVars: []string{"STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
},
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,172 +0,0 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/userdrivers"
"github.com/urfave/cli/v2"
)
// 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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.DebugAddr, "127.0.0.1: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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.GRPCNetwork, "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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.GRPCAddr, "127.0.0.1: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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.HTTPNetwork, "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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.HTTPAddr, "127.0.0.1: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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.Driver, "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.BoolFlag{
Name: "dataprovider-insecure",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageUsers.DataProvider.Insecure, false),
Usage: "dataprovider insecure",
EnvVars: []string{"STORAGE_USERS_DATAPROVIDER_INSECURE", "OCIS_INSECURE"},
Destination: &cfg.Reva.StorageUsers.DataProvider.Insecure,
},
&cli.BoolFlag{
Name: "read-only",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageUsers.ReadOnly, false),
Usage: "use storage driver in read-only mode",
EnvVars: []string{"STORAGE_USERS_READ_ONLY", "OCIS_STORAGE_READ_ONLY"},
Destination: &cfg.Reva.StorageUsers.ReadOnly,
},
&cli.StringFlag{
Name: "mount-path",
Value: flags.OverrideDefaultString(cfg.Reva.StorageUsers.MountPath, "/users"),
Usage: "mount path",
EnvVars: []string{"STORAGE_USERS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageUsers.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: flags.OverrideDefaultString(cfg.Reva.StorageUsers.MountID, "1284d238-aa92-42ce-bdc4-0b0000009157"),
Usage: "mount id",
EnvVars: []string{"STORAGE_USERS_MOUNT_ID"},
Destination: &cfg.Reva.StorageUsers.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: flags.OverrideDefaultBool(cfg.Reva.StorageUsers.ExposeDataServer, 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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.DataServerURL, "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: flags.OverrideDefaultString(cfg.Reva.StorageUsers.HTTPPrefix, "data"),
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_USERS_HTTP_PREFIX"},
Destination: &cfg.Reva.StorageUsers.HTTPPrefix,
},
&cli.StringFlag{
Name: "tmp-folder",
Value: flags.OverrideDefaultString(cfg.Reva.StorageUsers.TempFolder, path.Join(defaults.BaseDataPath(), "tmp", "users")),
Usage: "path to tmp folder",
EnvVars: []string{"STORAGE_USERS_TMP_FOLDER"},
Destination: &cfg.Reva.StorageUsers.TempFolder,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "users-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Endpoint, "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, userdrivers.DriverEOSWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverLocalWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudSQLWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOCISWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverS3NGWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverS3WithConfig(cfg)...)
return flags
}

View File

@@ -1,48 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// TracingWithConfig applies cfg to the root flagset
func TracingWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.BoolFlag{
Name: "tracing-enabled",
Usage: "Enable sending traces",
EnvVars: []string{"STORAGE_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
Destination: &cfg.Tracing.Enabled,
},
&cli.StringFlag{
Name: "tracing-type",
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
Usage: "Tracing backend type",
EnvVars: []string{"STORAGE_TRACING_TYPE", "OCIS_TRACING_TYPE"},
Destination: &cfg.Tracing.Type,
},
&cli.StringFlag{
Name: "tracing-endpoint",
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
Usage: "Endpoint for the agent",
EnvVars: []string{"STORAGE_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
Destination: &cfg.Tracing.Endpoint,
},
&cli.StringFlag{
Name: "tracing-collector",
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
Usage: "Endpoint for the collector",
EnvVars: []string{"STORAGE_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "storage"),
Usage: "Service name for tracing",
EnvVars: []string{"STORAGE_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service,
},
}
}

View File

@@ -1,136 +0,0 @@
package userdrivers
import (
"os"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverEOSWithConfig applies cfg to the root flagset
func DriverEOSWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-eos-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.Root, "/eos/dockertest/reva"),
Usage: "Namespace for metadata operations",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.Root,
},
&cli.StringFlag{
Name: "storage-eos-shadow-namespace",
// Defaults to path.Join(c.Namespace, ".shadow")
Usage: "Shadow namespace where share references are stored",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHADOW_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.ShadowNamespace,
},
&cli.StringFlag{
Name: "storage-eos-uploads-namespace",
// Defaults to path.Join(c.Namespace, ".uploads")
Usage: "Uploads namespace",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_UPLOADS_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.UploadsNamespace,
},
&cli.StringFlag{
Name: "storage-eos-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.ShareFolder, "/Shares"),
Usage: "name of the share folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.EOS.ShareFolder,
},
&cli.StringFlag{
Name: "storage-eos-binary",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.EosBinary, "/usr/bin/eos"),
Usage: "Location of the eos binary",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_BINARY"},
Destination: &cfg.Reva.UserStorage.EOS.EosBinary,
},
&cli.StringFlag{
Name: "storage-eos-xrdcopy-binary",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.XrdcopyBinary, "/usr/bin/xrdcopy"),
Usage: "Location of the xrdcopy binary",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_XRDCOPY_BINARY"},
Destination: &cfg.Reva.UserStorage.EOS.XrdcopyBinary,
},
&cli.StringFlag{
Name: "storage-eos-master-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.MasterURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Master EOS MGM",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_MASTER_URL"},
Destination: &cfg.Reva.UserStorage.EOS.MasterURL,
},
&cli.StringFlag{
Name: "storage-eos-slave-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.SlaveURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Slave EOS MGM",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SLAVE_URL"},
Destination: &cfg.Reva.UserStorage.EOS.SlaveURL,
},
&cli.StringFlag{
Name: "storage-eos-cache-directory",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.CacheDirectory, os.TempDir()),
Usage: "Location on the local fs where to store reads",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_CACHE_DIRECTORY"},
Destination: &cfg.Reva.UserStorage.EOS.CacheDirectory,
},
&cli.BoolFlag{
Name: "storage-eos-enable-logging",
Usage: "Enables logging of the commands executed",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_ENABLE_LOGGING"},
Destination: &cfg.Reva.UserStorage.EOS.EnableLogging,
},
&cli.BoolFlag{
Name: "storage-eos-show-hidden-sysfiles",
Usage: "show internal EOS files like .sys.v# and .sys.a# files.",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHOW_HIDDEN_SYSFILES"},
Destination: &cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
},
&cli.BoolFlag{
Name: "storage-eos-force-singleuser-mode",
Usage: "force connections to EOS to use SingleUsername",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_FORCE_SINGLEUSER_MODE"},
Destination: &cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
},
&cli.BoolFlag{
Name: "storage-eos-use-keytab",
Usage: "authenticate requests by using an EOS keytab",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_USE_KEYTAB"},
Destination: &cfg.Reva.UserStorage.EOS.UseKeytab,
},
&cli.StringFlag{
Name: "storage-eos-sec-protocol",
Usage: "the xrootd security protocol to use between the server and EOS",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SEC_PROTOCOL"},
Destination: &cfg.Reva.UserStorage.EOS.SecProtocol,
},
&cli.StringFlag{
Name: "storage-eos-keytab",
Usage: "the location of the keytab to use to authenticate to EOS",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_KEYTAB"},
Destination: &cfg.Reva.UserStorage.EOS.Keytab,
},
&cli.StringFlag{
Name: "storage-eos-single-username",
Usage: "the username to use when SingleUserMode is enabled",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SINGLE_USERNAME"},
Destination: &cfg.Reva.UserStorage.EOS.SingleUsername,
},
&cli.StringFlag{
Name: "storage-eos-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.UserLayout, "{{substr 0 1 .Username}}/{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_LAYOUT"},
Destination: &cfg.Reva.UserStorage.EOS.UserLayout,
},
&cli.StringFlag{
Name: "storage-eos-reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.GatewaySVC, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.UserStorage.EOS.GatewaySVC,
},
}
}

View File

@@ -1,37 +0,0 @@
package userdrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverLocalWithConfig applies cfg to the root flagset
func DriverLocalWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-local-root",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.Local.Root, path.Join(defaults.BaseDataPath(), "storage", "local", "users")),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_ROOT"},
Destination: &cfg.Reva.UserStorage.Local.Root,
},
&cli.StringFlag{
Name: "storage-local-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.Local.ShareFolder, "/Shares"),
Usage: "the path to the local share folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.Local.ShareFolder,
},
&cli.StringFlag{
Name: "storage-local-user-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.Local.UserLayout, "{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_USER_LAYOUT"},
Destination: &cfg.Reva.UserStorage.Local.UserLayout,
},
}
}

View File

@@ -1,44 +0,0 @@
package userdrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOCISWithConfig applies cfg to the root flagset
func DriverOCISWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-ocis-root",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OCIS.Root, path.Join(defaults.BaseDataPath(), "storage", "users")),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_ROOT"},
Destination: &cfg.Reva.UserStorage.OCIS.Root,
},
&cli.StringFlag{
Name: "storage-ocis-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OCIS.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_LAYOUT"},
Destination: &cfg.Reva.UserStorage.OCIS.UserLayout,
},
&cli.StringFlag{
Name: "storage-ocis-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OCIS.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.OCIS.ShareFolder,
},
&cli.StringFlag{
Name: "service-user-uuid",
Value: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
Usage: "uuid of the internal service user",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SERVICE_USER_UUID"},
Destination: &cfg.Reva.UserStorage.OCIS.ServiceUserUUID,
},
}
}

View File

@@ -1,58 +0,0 @@
package userdrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudWithConfig applies cfg to the root flagset
func DriverOwnCloudWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloud-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.Root, path.Join(defaults.BaseDataPath(), "storage", "owncloud")),
Usage: "the path to the owncloud data directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_DATADIR"},
Destination: &cfg.Reva.UserStorage.OwnCloud.Root,
},
&cli.StringFlag{
Name: "storage-owncloud-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.UploadInfoDir, path.Join(defaults.BaseDataPath(), "storage", "uploadinfo")),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_UPLOADINFO_DIR"},
Destination: &cfg.Reva.UserStorage.OwnCloud.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloud-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.OwnCloud.ShareFolder,
},
&cli.BoolFlag{
Name: "storage-owncloud-scan",
Value: flags.OverrideDefaultBool(cfg.Reva.UserStorage.OwnCloud.Scan, true),
Usage: "scan files on startup to add fileids",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_SCAN"},
Destination: &cfg.Reva.UserStorage.OwnCloud.Scan,
},
&cli.StringFlag{
Name: "storage-owncloud-redis",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.Redis, ":6379"),
Usage: "the address of the redis server",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_REDIS_ADDR"},
Destination: &cfg.Reva.UserStorage.OwnCloud.Redis,
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.UserStorage.OwnCloud.UserLayout,
},
}
}

View File

@@ -1,79 +0,0 @@
package userdrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudSQLWithConfig applies cfg to the root flagset
func DriverOwnCloudSQLWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloudsql-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.Root, path.Join(defaults.BaseDataPath(), "storage", "owncloud")),
Usage: "the path to the owncloudsql data directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DATADIR"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.Root,
},
&cli.StringFlag{
Name: "storage-owncloudsql-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir, path.Join(defaults.BaseDataPath(), "storage", "uploadinfo")),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_UPLOADINFO_DIR"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloudsql-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder,
},
&cli.StringFlag{
Name: "storage-owncloudsql-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.UserLayout, "{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_LAYOUT"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.UserLayout,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbusername",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.DBUsername, "owncloud"),
Usage: `"username for accessing the database" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBUSERNAME"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBUsername,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbpassword",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.DBPassword, "owncloud"),
Usage: `"password for accessing the database" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBPASSWORD"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBPassword,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbhost",
Value: cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
Usage: `"the database hostname or IP address" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBHOST"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
},
&cli.IntFlag{
Name: "storage-owncloudsql-dbport",
Value: flags.OverrideDefaultInt(cfg.Reva.UserStorage.OwnCloudSQL.DBPort, 3306),
Usage: `"port the database listens on" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBPORT"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBPort,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbname",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.DBName, "owncloud"),
Usage: `"the database name" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBNAME"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBName,
},
}
}

View File

@@ -1,48 +0,0 @@
package userdrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverS3NGWithConfig applies cfg to the root flagset
func DriverS3WithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-s3-region",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3.Region, "default"),
Usage: `"the s3 region" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3_REGION"},
Destination: &cfg.Reva.UserStorage.S3.Region,
},
&cli.StringFlag{
Name: "storage-s3-accesskey",
Value: "",
Usage: `"the s3 access key" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3_ACCESS_KEY"},
Destination: &cfg.Reva.UserStorage.S3.AccessKey,
},
&cli.StringFlag{
Name: "storage-s3-secretkey",
Value: "",
Usage: `"the secret s3 api key" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3_SECRET_KEY"},
Destination: &cfg.Reva.UserStorage.S3.SecretKey,
},
&cli.StringFlag{
Name: "storage-s3-endpoint",
Value: "",
Usage: `"s3 compatible API endpoint" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3_ENDPOINT"},
Destination: &cfg.Reva.UserStorage.S3.Endpoint,
},
&cli.StringFlag{
Name: "storage-s3-bucket",
Value: "",
Usage: `"bucket where the data will be stored in`,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3_BUCKET"},
Destination: &cfg.Reva.UserStorage.S3.Bucket,
},
}
}

View File

@@ -1,72 +0,0 @@
package userdrivers
import (
"path"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverS3NGWithConfig applies cfg to the root flagset
func DriverS3NGWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-s3ng-root",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.Root, path.Join(defaults.BaseDataPath(), "storage", "users")),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ROOT"},
Destination: &cfg.Reva.UserStorage.S3NG.Root,
},
&cli.StringFlag{
Name: "storage-s3ng-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_LAYOUT"},
Destination: &cfg.Reva.UserStorage.S3NG.UserLayout,
},
&cli.StringFlag{
Name: "storage-s3ng-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.S3NG.ShareFolder,
},
&cli.StringFlag{
Name: "storage-s3ng-region",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.Region, "default"),
Usage: `"the s3 region" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_REGION"},
Destination: &cfg.Reva.UserStorage.S3NG.Region,
},
&cli.StringFlag{
Name: "storage-s3ng-accesskey",
Value: "",
Usage: `"the s3 access key" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ACCESS_KEY"},
Destination: &cfg.Reva.UserStorage.S3NG.AccessKey,
},
&cli.StringFlag{
Name: "storage-s3ng-secretkey",
Value: "",
Usage: `"the secret s3 api key" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SECRET_KEY"},
Destination: &cfg.Reva.UserStorage.S3NG.SecretKey,
},
&cli.StringFlag{
Name: "storage-s3ng-endpoint",
Value: "",
Usage: `"s3 compatible API endpoint" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ENDPOINT"},
Destination: &cfg.Reva.UserStorage.S3NG.Endpoint,
},
&cli.StringFlag{
Name: "storage-s3ng-bucket",
Value: "",
Usage: `"bucket where the data will be stored in`,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_BUCKET"},
Destination: &cfg.Reva.UserStorage.S3NG.Bucket,
},
}
}

View File

@@ -1,167 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// UsersWithConfig applies cfg to the root flagset
func UsersWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Users.DebugAddr, "127.0.0.1:9145"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_USERPROVIDER_DEBUG_ADDR"},
Destination: &cfg.Reva.Users.DebugAddr,
},
// Services
// Gateway
&cli.StringFlag{
Name: "reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// Userprovider
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.Users.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERPROVIDER_NETWORK"},
Destination: &cfg.Reva.Users.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.Users.GRPCAddr, "127.0.0.1:9144"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ADDR"},
Destination: &cfg.Reva.Users.GRPCAddr,
},
&cli.StringFlag{
Name: "endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Endpoint, "localhost:9144"),
Usage: "URL to use for the storage service",
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_USERPROVIDER_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Driver, "ldap"),
Usage: "user driver: 'demo', 'json', 'ldap', 'owncloudsql' or 'rest'",
EnvVars: []string{"STORAGE_USERPROVIDER_DRIVER"},
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "json-config",
Value: flags.OverrideDefaultString(cfg.Reva.Users.JSON, ""),
Usage: "Path to users.json file",
EnvVars: []string{"STORAGE_USERPROVIDER_JSON"},
Destination: &cfg.Reva.Users.JSON,
},
&cli.IntFlag{
Name: "user-groups-cache-expiration",
Value: flags.OverrideDefaultInt(cfg.Reva.Users.UserGroupsCacheExpiration, 5),
Usage: "Time in minutes for redis cache expiration.",
EnvVars: []string{"STORAGE_USER_CACHE_EXPIRATION"},
Destination: &cfg.Reva.Users.UserGroupsCacheExpiration,
},
// user owncloudsql
&cli.StringFlag{
Name: "owncloudsql-dbhost",
Value: flags.OverrideDefaultString(cfg.Reva.UserOwnCloudSQL.DBHost, "mysql"),
Usage: "hostname of the mysql db",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBHOST"},
Destination: &cfg.Reva.UserOwnCloudSQL.DBHost,
},
&cli.IntFlag{
Name: "owncloudsql-dbport",
Value: flags.OverrideDefaultInt(cfg.Reva.UserOwnCloudSQL.DBPort, 3306),
Usage: "port of the mysql db",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBPORT"},
Destination: &cfg.Reva.UserOwnCloudSQL.DBPort,
},
&cli.StringFlag{
Name: "owncloudsql-dbname",
Value: flags.OverrideDefaultString(cfg.Reva.UserOwnCloudSQL.DBName, "owncloud"),
Usage: "database name of the owncloud db",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBNAME"},
Destination: &cfg.Reva.UserOwnCloudSQL.DBName,
},
&cli.StringFlag{
Name: "owncloudsql-dbuser",
Value: flags.OverrideDefaultString(cfg.Reva.UserOwnCloudSQL.DBUsername, "owncloud"),
Usage: "user name to use when connecting to the mysql owncloud db",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBUSER"},
Destination: &cfg.Reva.UserOwnCloudSQL.DBUsername,
},
&cli.StringFlag{
Name: "owncloudsql-dbpass",
Value: flags.OverrideDefaultString(cfg.Reva.UserOwnCloudSQL.DBPassword, "secret"),
Usage: "password to use when connecting to the mysql owncloud db",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_DBPASS"},
Destination: &cfg.Reva.UserOwnCloudSQL.DBPassword,
},
&cli.StringFlag{
Name: "owncloudsql-idp",
Value: flags.OverrideDefaultString(cfg.Reva.UserOwnCloudSQL.Idp, "https://localhost:9200"),
Usage: "Identity provider to use for users",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_IDP", "OCIS_URL"},
Destination: &cfg.Reva.UserOwnCloudSQL.Idp,
},
&cli.Int64Flag{
Name: "owncloudsql-nobody",
Value: flags.OverrideDefaultInt64(cfg.Reva.UserOwnCloudSQL.Nobody, 99),
Usage: "fallback user id to use when user has no id",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_NOBODY"},
Destination: &cfg.Reva.UserOwnCloudSQL.Nobody,
},
&cli.BoolFlag{
Name: "owncloudsql-join-username",
Value: flags.OverrideDefaultBool(cfg.Reva.UserOwnCloudSQL.JoinUsername, false),
Usage: "join the username from the oc_preferences table",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_JOIN_USERNAME"},
Destination: &cfg.Reva.UserOwnCloudSQL.JoinUsername,
},
&cli.BoolFlag{
Name: "owncloudsql-join-ownclouduuid",
Value: flags.OverrideDefaultBool(cfg.Reva.UserOwnCloudSQL.JoinOwnCloudUUID, false),
Usage: "join the ownclouduuid from the oc_preferences table",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_JOIN_OWNCLOUDUUID"},
Destination: &cfg.Reva.UserOwnCloudSQL.JoinOwnCloudUUID,
},
&cli.BoolFlag{
Name: "owncloudsql-enable-medial-search",
Value: flags.OverrideDefaultBool(cfg.Reva.UserOwnCloudSQL.EnableMedialSearch, false),
Usage: "enable medial search when finding users",
EnvVars: []string{"STORAGE_USERPROVIDER_OWNCLOUDSQL_ENABLE_MEDIAL_SEARCH"},
Destination: &cfg.Reva.UserOwnCloudSQL.EnableMedialSearch,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, LDAPWithConfig(cfg)...)
flags = append(flags, RestWithConfig(cfg)...)
return flags
}