update reva and refactor config

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2020-10-21 10:15:09 +02:00
committed by David Christofas
parent d9d7272299
commit b64b3242e2
48 changed files with 597 additions and 2279 deletions
+4 -18
View File
@@ -43,29 +43,15 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage auth-basic service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_BASIC_NETWORK"},
Destination: &cfg.Reva.AuthBasic.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_AUTH_BASIC_PROTOCOL"},
Destination: &cfg.Reva.AuthBasic.Protocol,
EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthBasic.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9146",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_ADDR"},
Destination: &cfg.Reva.AuthBasic.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9146",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_URL"},
Destination: &cfg.Reva.AuthBasic.URL,
EnvVars: []string{"STORAGE_AUTH_BASIC_GRPC_ADDR"},
Destination: &cfg.Reva.AuthBasic.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
+6 -20
View File
@@ -48,14 +48,14 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.OIDC.IDClaim,
},
&cli.StringFlag{
Name: "oidc-uid-claim",
Name: "oidc-uid-claim",
Value: "",
Usage: "OIDC uid claim",
EnvVars: []string{"STORAGE_OIDC_UID_CLAIM"},
Destination: &cfg.Reva.OIDC.UIDClaim,
},
&cli.StringFlag{
Name: "oidc-gid-claim",
Name: "oidc-gid-claim",
Value: "",
Usage: "OIDC gid claim",
EnvVars: []string{"STORAGE_OIDC_GID_CLAIM"},
@@ -70,29 +70,15 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_AUTH_BEARER_NETWORK"},
Destination: &cfg.Reva.AuthBearer.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_AUTH_BEARER_PROTOCOL"},
Destination: &cfg.Reva.AuthBearer.Protocol,
EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_NETWORK"},
Destination: &cfg.Reva.AuthBearer.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9148",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_ADDR"},
Destination: &cfg.Reva.AuthBearer.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9148",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_URL"},
Destination: &cfg.Reva.AuthBearer.URL,
EnvVars: []string{"STORAGE_AUTH_BEARER_GRPC_ADDR"},
Destination: &cfg.Reva.AuthBearer.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
+9 -16
View File
@@ -56,29 +56,22 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_FRONTEND_NETWORK"},
Destination: &cfg.Reva.Frontend.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_FRONTEND_PROTOCOL"},
Destination: &cfg.Reva.Frontend.Protocol,
EnvVars: []string{"STORAGE_FRONTEND_HTTP_NETWORK"},
Destination: &cfg.Reva.Frontend.HTTPNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9140",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_FRONTEND_ADDR"},
Destination: &cfg.Reva.Frontend.Addr,
EnvVars: []string{"STORAGE_FRONTEND_HTTP_ADDR"},
Destination: &cfg.Reva.Frontend.HTTPAddr,
},
&cli.StringFlag{
Name: "url",
Name: "public-url",
Value: "https://localhost:9200",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_FRONTEND_URL"},
Destination: &cfg.Reva.Frontend.URL,
EnvVars: []string{"STORAGE_FRONTEND_PUBLIC_URL"},
Destination: &cfg.Reva.Frontend.PublicURL,
},
&cli.StringSliceFlag{
Name: "service",
@@ -114,8 +107,8 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// Chunking
+63 -107
View File
@@ -45,29 +45,22 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_GATEWAY_NETWORK"},
Destination: &cfg.Reva.Gateway.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_GATEWAY_PROTOCOL"},
Destination: &cfg.Reva.Gateway.Protocol,
EnvVars: []string{"STORAGE_GATEWAY_GRPC_NETWORK"},
Destination: &cfg.Reva.Gateway.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9142",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_GATEWAY_ADDR"},
Destination: &cfg.Reva.Gateway.Addr,
EnvVars: []string{"STORAGE_GATEWAY_GRPC_ADDR"},
Destination: &cfg.Reva.Gateway.GRPCAddr,
},
&cli.StringFlag{
Name: "url",
Name: "endpoint",
Value: "localhost:9142",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
@@ -107,6 +100,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
// other services
&cli.StringFlag{
Name: "auth-basic-endpoint",
Value: "localhost:9146",
Usage: "endpoint to use for the basic auth provider",
EnvVars: []string{"STORAGE_AUTH_BASIC_ENDPOINT"},
Destination: &cfg.Reva.AuthBasic.Endpoint,
},
&cli.StringFlag{
Name: "auth-bearer-endpoint",
Value: "localhost:9148",
Usage: "endpoint to use for the bearer auth provider",
EnvVars: []string{"STORAGE_AUTH_BEARER_ENDPOINT"},
Destination: &cfg.Reva.AuthBearer.Endpoint,
},
// storage registry
&cli.StringFlag{
@@ -127,81 +135,47 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Name: "storage-home-provider",
Value: "/home",
Usage: "mount point of the storage provider for user homes in the global namespace",
EnvVars: []string{"STORAGE_STORAGE_HOME_PROVIDER"},
EnvVars: []string{"STORAGE_REGISTRY_HOME_PROVIDER"},
Destination: &cfg.Reva.StorageRegistry.HomeProvider,
},
&cli.StringFlag{
Name: "frontend-url",
Name: "public-url",
Value: "https://localhost:9200",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_FRONTEND_URL"},
Destination: &cfg.Reva.Frontend.URL,
EnvVars: []string{"STORAGE_FRONTEND_PUBLIC_URL"},
Destination: &cfg.Reva.Frontend.PublicURL,
},
&cli.StringFlag{
Name: "datagateway-url",
Value: "https://localhost:9200/data",
Usage: "URL to use for the storage datagateway",
EnvVars: []string{"STORAGE_DATAGATEWAY_URL"},
Destination: &cfg.Reva.DataGateway.URL,
EnvVars: []string{"STORAGE_DATAGATEWAY_PUBLIC_URL"},
Destination: &cfg.Reva.DataGateway.PublicURL,
},
&cli.StringFlag{
Name: "users-url",
Name: "userprovider-endpoint",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
Usage: "endpoint to use for the userprovider",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
&cli.StringFlag{
Name: "auth-basic-url",
Value: "localhost:9146",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BASIC_URL"},
Destination: &cfg.Reva.AuthBasic.URL,
},
&cli.StringFlag{
Name: "auth-bearer-url",
Value: "localhost:9148",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_AUTH_BEARER_URL"},
Destination: &cfg.Reva.AuthBearer.URL,
},
&cli.StringFlag{
Name: "sharing-url",
Name: "sharing-endpoint",
Value: "localhost:9150",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_URL"},
Destination: &cfg.Reva.Sharing.URL,
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_ENDPOINT"},
Destination: &cfg.Reva.Sharing.Endpoint,
},
&cli.StringFlag{
Name: "storage-root-url",
Value: "localhost:9152",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_ROOT_URL"},
Destination: &cfg.Reva.StorageRoot.URL,
},
&cli.StringFlag{
Name: "storage-root-mount-path",
Value: "/",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_PATH"},
Destination: &cfg.Reva.StorageRoot.MountPath,
},
&cli.StringFlag{
Name: "storage-root-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009152",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_ID"},
Destination: &cfg.Reva.StorageRoot.MountID,
},
// register home storage
&cli.StringFlag{
Name: "storage-home-url",
Name: "storage-home-endpoint",
Value: "localhost:9154",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_URL"},
Destination: &cfg.Reva.StorageHome.URL,
Usage: "endpoint to use for the home storage",
EnvVars: []string{"STORAGE_STORAGE_HOME_ENDPOINT"},
Destination: &cfg.Reva.StorageHome.Endpoint,
},
&cli.StringFlag{
Name: "storage-home-mount-path",
@@ -218,60 +192,42 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.StorageHome.MountID,
},
&cli.StringFlag{
Name: "storage-eos-url",
Value: "localhost:9158",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_URL"},
Destination: &cfg.Reva.StorageEOS.URL,
},
&cli.StringFlag{
Name: "storage-eos-mount-path",
Value: "/eos",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageEOS.MountPath,
},
&cli.StringFlag{
Name: "storage-eos-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009158",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_ID"},
Destination: &cfg.Reva.StorageEOS.MountID,
},
// register users storage
&cli.StringFlag{
Name: "storage-oc-url",
Value: "localhost:9162",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_URL"},
Destination: &cfg.Reva.StorageOC.URL,
Name: "storage-users-endpoint",
Value: "localhost:9157",
Usage: "endpoint to use for the users storage",
EnvVars: []string{"STORAGE_USERS_ENDPOINT"},
Destination: &cfg.Reva.StorageUsers.Endpoint,
},
&cli.StringFlag{
Name: "storage-oc-mount-path",
Value: "/oc",
Name: "storage-users-mount-path",
Value: "/users",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_PATH"},
Destination: &cfg.Reva.StorageOC.MountPath,
EnvVars: []string{"STORAGE_USERS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageUsers.MountPath,
},
&cli.StringFlag{
Name: "storage-oc-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009162",
Name: "storage-users-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009157",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_ID"},
Destination: &cfg.Reva.StorageOC.MountID,
EnvVars: []string{"STORAGE_USERS_MOUNT_ID"},
Destination: &cfg.Reva.StorageUsers.MountID,
},
// register public link storage
&cli.StringFlag{
Name: "public-link-url",
Name: "public-link-endpoint",
Value: "localhost:9178",
Usage: "URL to use for the public links service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_URL"},
Destination: &cfg.Reva.StoragePublicLink.URL,
Usage: "endpoint to use for the public links service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_ENDPOINT"},
Destination: &cfg.Reva.StoragePublicLink.Endpoint,
},
&cli.StringFlag{
Name: "storage-public-link-mount-path",
Value: "/public/",
Value: "/public",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
+4 -18
View File
@@ -26,29 +26,15 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_SHARING_NETWORK"},
Destination: &cfg.Reva.Sharing.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_SHARING_PROTOCOL"},
Destination: &cfg.Reva.Sharing.Protocol,
EnvVars: []string{"STORAGE_SHARING_GRPC_NETWORK"},
Destination: &cfg.Reva.Sharing.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9150",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_SHARING_ADDR"},
Destination: &cfg.Reva.Sharing.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9150",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_SHARING_URL"},
Destination: &cfg.Reva.Sharing.URL,
EnvVars: []string{"STORAGE_SHARING_GRPC_ADDR"},
Destination: &cfg.Reva.Sharing.GRPCAddr,
},
&cli.StringSliceFlag{
Name: "service",
-104
View File
@@ -1,104 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageEOSWithConfig applies cfg to the root flagset
func StorageEOSWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9159",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_EOS_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageEOS.DebugAddr,
},
// Storage eos
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_EOS_NETWORK"},
Destination: &cfg.Reva.StorageEOS.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_EOS_PROTOCOL"},
Destination: &cfg.Reva.StorageEOS.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9158",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_ADDR"},
Destination: &cfg.Reva.StorageEOS.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9158",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_URL"},
Destination: &cfg.Reva.StorageEOS.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_EOS_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "eos",
Usage: "storage driver for eos mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_EOS_DRIVER"},
Destination: &cfg.Reva.StorageEOS.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/eos",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageEOS.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009158",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_EOS_MOUNT_ID"},
Destination: &cfg.Reva.StorageEOS.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_EOS_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageEOS.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9160/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageEOS.DataServerURL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
-111
View File
@@ -1,111 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageEOSDataWithConfig applies cfg to the root flagset
func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9161",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageEOSData.DebugAddr,
},
// Services
// Storage eos data
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_NETWORK"},
Destination: &cfg.Reva.StorageEOSData.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_PROTOCOL"},
Destination: &cfg.Reva.StorageEOSData.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9160",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_ADDR"},
Destination: &cfg.Reva.StorageEOSData.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9160",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_URL"},
Destination: &cfg.Reva.StorageEOSData.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "eos",
Usage: "storage driver for eos data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_DRIVER"},
Destination: &cfg.Reva.StorageEOSData.Driver,
},
&cli.StringFlag{
Name: "prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_PREFIX"},
Destination: &cfg.Reva.StorageEOSData.Prefix,
},
&cli.StringFlag{
Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_EOS_DATA_TEMP_FOLDER"},
Destination: &cfg.Reva.StorageEOSData.TempFolder,
},
// Gateway
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+67 -41
View File
@@ -12,9 +12,9 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9155",
Value: "0.0.0.0:9156",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_HOME_DEBUG_ADDR"},
EnvVars: []string{"STORAGE_HOME_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageHome.DebugAddr,
},
@@ -23,95 +23,121 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
// Storage home
&cli.StringFlag{
Name: "network",
Name: "grpc-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_HOME_NETWORK"},
Destination: &cfg.Reva.StorageHome.Network,
EnvVars: []string{"STORAGE_HOME_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageHome.GRPCNetwork,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_HOME_PROTOCOL"},
Destination: &cfg.Reva.StorageHome.Protocol,
},
&cli.StringFlag{
Name: "addr",
Name: "grpc-addr",
Value: "0.0.0.0:9154",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_ADDR"},
Destination: &cfg.Reva.StorageHome.Addr,
EnvVars: []string{"STORAGE_HOME_GRPC_ADDR"},
Destination: &cfg.Reva.StorageHome.GRPCAddr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9154",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_URL"},
Destination: &cfg.Reva.StorageHome.URL,
Name: "http-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_HOME_HTTP_NETWORK"},
Destination: &cfg.Reva.StorageHome.HTTPNetwork,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_HOME_SERVICES"},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9155",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_HOME_HTTP_ADDR"},
Destination: &cfg.Reva.StorageHome.HTTPAddr,
},
// TODO allow disabling grpc / http services
/*
&cli.StringSliceFlag{
Name: "grpc-service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_HOME_GRPC_SERVICES"},
},
&cli.StringSliceFlag{
Name: "http-service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_HOME_HTTP_SERVICES"},
},
*/
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Value: "ocis",
Usage: "storage driver for home mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_HOME_DRIVER"},
EnvVars: []string{"STORAGE_HOME_DRIVER"},
Destination: &cfg.Reva.StorageHome.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/home",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_HOME_MOUNT_PATH"},
EnvVars: []string{"STORAGE_HOME_MOUNT_PATH"},
Destination: &cfg.Reva.StorageHome.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
// This is the mount id of the storage provider using the same storage driver
// as /home but withoud home enabled. Set it to
// 1284d238-aa92-42ce-bdc4-0b0000009158 for /eos
// 1284d238-aa92-42ce-bdc4-0b0000009162 for /oc
Value: "1284d238-aa92-42ce-bdc4-0b0000009162", // /oc
// as /home but withoud home enabled.
Value: "1284d238-aa92-42ce-bdc4-0b0000009162", // /users
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_HOME_MOUNT_ID"},
EnvVars: []string{"STORAGE_HOME_MOUNT_ID"},
Destination: &cfg.Reva.StorageHome.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_HOME_EXPOSE_DATA_SERVER"},
EnvVars: []string{"STORAGE_HOME_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageHome.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9156/data",
Value: "http://localhost:9155/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_SERVER_URL"},
EnvVars: []string{"STORAGE_HOME_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageHome.DataServerURL,
},
&cli.StringFlag{
Name: "http-prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_HOME_HTTP_PREFIX"},
Destination: &cfg.Reva.StorageHome.HTTPPrefix,
},
&cli.BoolFlag{
Name: "enable-home",
Value: true,
Usage: "enable the creation of home directories",
EnvVars: []string{"STORAGE_STORAGE_HOME_ENABLE_HOME"},
EnvVars: []string{"STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Name: "users-endpoint",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
-118
View File
@@ -1,118 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageHomeDataWithConfig applies cfg to the root flagset
func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9157",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageHomeData.DebugAddr,
},
// Services
// Storage home data
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_NETWORK"},
Destination: &cfg.Reva.StorageHomeData.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_PROTOCOL"},
Destination: &cfg.Reva.StorageHomeData.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9156",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_ADDR"},
Destination: &cfg.Reva.StorageHomeData.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9156",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_URL"},
Destination: &cfg.Reva.StorageHomeData.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver for home data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_DRIVER"},
Destination: &cfg.Reva.StorageHomeData.Driver,
},
&cli.StringFlag{
Name: "prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_PREFIX"},
Destination: &cfg.Reva.StorageHomeData.Prefix,
},
&cli.StringFlag{
Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_TEMP_FOLDER"},
Destination: &cfg.Reva.StorageHomeData.TempFolder,
},
&cli.BoolFlag{
Name: "enable-home",
Value: true,
Usage: "enable the creation of home directories",
EnvVars: []string{"STORAGE_STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// Gateway
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+46 -24
View File
@@ -12,58 +12,80 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
Name: "debug-addr",
Value: "0.0.0.0:9217",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DEBUG_ADDR"},
EnvVars: []string{"STORAGE_METADATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageMetadata.DebugAddr,
},
&cli.StringFlag{
Name: "network",
Name: "grpc-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_METADATA_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.Network,
EnvVars: []string{"STORAGE_METADATA_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.GRPCNetwork,
},
&cli.StringFlag{
Name: "provider-addr",
Name: "grpc-addr",
Value: "0.0.0.0:9215",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_METADATA_PROVIDER_ADDR"},
Destination: &cfg.Reva.StorageMetadata.Addr,
EnvVars: []string{"STORAGE_METADATA_GRPC_PROVIDER_ADDR"},
Destination: &cfg.Reva.StorageMetadata.GRPCAddr,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9216",
Usage: "URL of the data-server the storage-provider uses",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DATA_SERVER_URL"},
Usage: "URL of the data-provider the storage-provider uses",
EnvVars: []string{"STORAGE_METADATA_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageMetadata.DataServerURL,
},
&cli.StringFlag{
Name: "data-server-addr",
Name: "http-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_METADATA_HTTP_NETWORK"},
Destination: &cfg.Reva.StorageMetadata.HTTPNetwork,
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9216",
Usage: "Address to bind the metadata data-server to",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DATA_SERVER_ADDR"},
Destination: &cfg.Reva.StorageMetadataData.Addr,
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_METADATA_HTTP_ADDR"},
Destination: &cfg.Reva.StorageMetadata.HTTPAddr,
},
&cli.StringFlag{
Name: "storage-provider-driver",
Value: "local",
Name: "driver",
Value: "ocis",
Usage: "storage driver for metadata mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_METADATA_PROVIDER_DRIVER"},
EnvVars: []string{"STORAGE_METADATA_DRIVER"},
Destination: &cfg.Reva.StorageMetadata.Driver,
},
&cli.StringFlag{
Name: "data-provider-driver",
Value: "local",
Usage: "storage driver for data-provider mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_METADATA_DATA_PROVIDER_DRIVER"},
Destination: &cfg.Reva.StorageMetadataData.Driver,
},
&cli.StringFlag{
Name: "storage-root",
Value: "/var/tmp/ocis/metadata",
Usage: "the path to the metadata storage root",
EnvVars: []string{"STORAGE_STORAGE_METADATA_ROOT"},
EnvVars: []string{"STORAGE_METADATA_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "endpoint to use for the gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "userprovider-endpoint",
Value: "localhost:9144",
Usage: "endpoint to use for the userprovider service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
-116
View File
@@ -1,116 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageOCWithConfig applies cfg to the root flagset
func StorageOCWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9163",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_OC_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageOC.DebugAddr,
},
// Services
// Storage oc
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_OC_NETWORK"},
Destination: &cfg.Reva.StorageOC.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_OC_PROTOCOL"},
Destination: &cfg.Reva.StorageOC.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9162",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_ADDR"},
Destination: &cfg.Reva.StorageOC.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9162",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_URL"},
Destination: &cfg.Reva.StorageOC.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_OC_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver for oc mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_OC_DRIVER"},
Destination: &cfg.Reva.StorageOC.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/oc",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_PATH"},
Destination: &cfg.Reva.StorageOC.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009162",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_OC_MOUNT_ID"},
Destination: &cfg.Reva.StorageOC.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_OC_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageOC.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9164/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageOC.DataServerURL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
-111
View File
@@ -1,111 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageOCDataWithConfig applies cfg to the root flagset
func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9165",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageOCData.DebugAddr,
},
// Services
// Storage oc data
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_NETWORK"},
Destination: &cfg.Reva.StorageOCData.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "http",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_PROTOCOL"},
Destination: &cfg.Reva.StorageOCData.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9164",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_ADDR"},
Destination: &cfg.Reva.StorageOCData.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9164",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_URL"},
Destination: &cfg.Reva.StorageOCData.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver for oc data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DRIVER"},
Destination: &cfg.Reva.StorageOCData.Driver,
},
&cli.StringFlag{
Name: "prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_PREFIX"},
Destination: &cfg.Reva.StorageOCData.Prefix,
},
&cli.StringFlag{
Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_TEMP_FOLDER"},
Destination: &cfg.Reva.StorageOCData.TempFolder,
},
// Gateway
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+11 -25
View File
@@ -13,7 +13,7 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
Name: "debug-addr",
Value: "0.0.0.0:9179",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_DEBUG_ADDR"},
EnvVars: []string{"STORAGE_PUBLIC_LINK_DEBUG_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.DebugAddr,
},
@@ -21,45 +21,31 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_NETWORK"},
Destination: &cfg.Reva.StoragePublicLink.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_PROTOCOL"},
Destination: &cfg.Reva.StoragePublicLink.Protocol,
EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_NETWORK"},
Destination: &cfg.Reva.StoragePublicLink.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9178",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9178",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_URL"},
Destination: &cfg.Reva.StoragePublicLink.URL,
EnvVars: []string{"STORAGE_PUBLIC_LINK_GRPC_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.GRPCAddr,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/public/",
Value: "/public",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_PUBLIC_LINK_MOUNT_PATH"},
EnvVars: []string{"STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
},
&cli.StringFlag{
Name: "gateway-url",
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "URL to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
}
-105
View File
@@ -1,105 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageRootWithConfig applies cfg to the root flagset
func StorageRootWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9153",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_STORAGE_ROOT_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageRoot.DebugAddr,
},
// Services
// Storage root
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_STORAGE_ROOT_NETWORK"},
Destination: &cfg.Reva.StorageRoot.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_STORAGE_ROOT_PROTOCOL"},
Destination: &cfg.Reva.StorageRoot.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9152",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_STORAGE_ROOT_ADDR"},
Destination: &cfg.Reva.StorageRoot.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9152",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_STORAGE_ROOT_URL"},
Destination: &cfg.Reva.StorageRoot.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_STORAGE_ROOT_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "local",
Usage: "storage driver for root mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_ROOT_DRIVER"},
Destination: &cfg.Reva.StorageRoot.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/",
Usage: "mount path",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_PATH"},
Destination: &cfg.Reva.StorageRoot.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "123e4567-e89b-12d3-a456-426655440001",
Usage: "mount id",
EnvVars: []string{"STORAGE_STORAGE_ROOT_MOUNT_ID"},
Destination: &cfg.Reva.StorageRoot.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_STORAGE_ROOT_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageRoot.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_ROOT_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageRoot.DataServerURL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+143
View File
@@ -0,0 +1,143 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/storage/pkg/config"
)
// StorageUsersWithConfig applies cfg to the root flagset
func StorageUsersWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:9159",
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_USERS_DEBUG_ADDR"},
Destination: &cfg.Reva.StorageUsers.DebugAddr,
},
// Services
// Storage home
&cli.StringFlag{
Name: "grpc-network",
Value: "tcp",
Usage: "Network to use for the users storage, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERS_GRPC_NETWORK"},
Destination: &cfg.Reva.StorageUsers.GRPCNetwork,
},
&cli.StringFlag{
Name: "grpc-addr",
Value: "0.0.0.0:9157",
Usage: "GRPC Address to bind users storage",
EnvVars: []string{"STORAGE_USERS_GRPC_ADDR"},
Destination: &cfg.Reva.StorageUsers.GRPCAddr,
},
&cli.StringFlag{
Name: "http-network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERS_HTTP_NETWORK"},
Destination: &cfg.Reva.StorageUsers.HTTPNetwork,
},
&cli.StringFlag{
Name: "http-addr",
Value: "0.0.0.0:9158",
Usage: "HTTP Address to bind users storage",
EnvVars: []string{"STORAGE_USERS_HTTP_ADDR"},
Destination: &cfg.Reva.StorageUsers.HTTPAddr,
},
// TODO allow disabling grpc / http services
/*
&cli.StringSliceFlag{
Name: "grpc-service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERS_GRPC_SERVICES"},
},
&cli.StringSliceFlag{
Name: "http-service",
Value: cli.NewStringSlice("dataprovider"),
Usage: "--service dataprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERS_HTTP_SERVICES"},
},
*/
&cli.StringFlag{
Name: "driver",
Value: "ocis",
Usage: "storage driver for users mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_USERS_DRIVER"},
Destination: &cfg.Reva.StorageUsers.Driver,
},
&cli.StringFlag{
Name: "mount-path",
Value: "/users",
Usage: "mount path",
EnvVars: []string{"STORAGE_USERS_MOUNT_PATH"},
Destination: &cfg.Reva.StorageUsers.MountPath,
},
&cli.StringFlag{
Name: "mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009162", // /users
Usage: "mount id",
EnvVars: []string{"STORAGE_USERS_MOUNT_ID"},
Destination: &cfg.Reva.StorageUsers.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
EnvVars: []string{"STORAGE_USERS_EXPOSE_DATA_SERVER"},
Destination: &cfg.Reva.StorageUsers.ExposeDataServer,
},
&cli.StringFlag{
Name: "data-server-url",
Value: "http://localhost:9158/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_USERS_DATA_SERVER_URL"},
Destination: &cfg.Reva.StorageUsers.DataServerURL,
},
&cli.StringFlag{
Name: "http-prefix",
Value: "data",
Usage: "prefix for the http endpoint, without leading slash",
EnvVars: []string{"STORAGE_USERS_HTTP_PREFIX"},
Destination: &cfg.Reva.StorageUsers.HTTPPrefix,
},
// some drivers need to look up users at the gateway
// Gateway
&cli.StringFlag{
Name: "gateway-endpoint",
Value: "localhost:9142",
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
// User provider
&cli.StringFlag{
Name: "users-endpoint",
Value: "localhost:9144",
Usage: "endpoint to use for the storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}
+11 -18
View File
@@ -20,55 +20,48 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag {
// Services
// Users
// Userprovider
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERS_NETWORK"},
Destination: &cfg.Reva.Users.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for storage service, can be 'http' or 'grpc'",
EnvVars: []string{"STORAGE_USERS_PROTOCOL"},
Destination: &cfg.Reva.Users.Protocol,
EnvVars: []string{"STORAGE_USERPROVIDER_NETWORK"},
Destination: &cfg.Reva.Users.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9144",
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_USERS_ADDR"},
Destination: &cfg.Reva.Users.Addr,
EnvVars: []string{"STORAGE_USERPROVIDER_ADDR"},
Destination: &cfg.Reva.Users.GRPCAddr,
},
&cli.StringFlag{
Name: "url",
Name: "endpoint",
Value: "localhost:9144",
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("userprovider"), // TODO preferences
Usage: "--service userprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERS_SERVICES"},
EnvVars: []string{"STORAGE_USERPROVIDER_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "ldap",
Usage: "user driver: 'demo', 'json', 'ldap', or 'rest'",
EnvVars: []string{"STORAGE_USERS_DRIVER"},
EnvVars: []string{"STORAGE_USERPROVIDER_DRIVER"},
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "json-config",
Value: "",
Usage: "Path to users.json file",
EnvVars: []string{"STORAGE_USERS_JSON"},
EnvVars: []string{"STORAGE_USERPROVIDER_JSON"},
Destination: &cfg.Reva.Users.JSON,
},