From 35aea683016142ffc0743ec197883a6317e5f65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 26 Jun 2020 10:17:02 +0200 Subject: [PATCH] update config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- pkg/command/gateway.go | 24 +-- pkg/command/storageeos.go | 8 +- pkg/command/storageeosdata.go | 5 +- pkg/command/storagehome.go | 15 +- pkg/command/storagehomedata.go | 14 +- pkg/command/storageoc.go | 17 +- pkg/command/storageocdata.go | 14 +- pkg/command/storagepubliclink.go | 7 +- pkg/command/storageroot.go | 23 +-- pkg/config/config.go | 25 ++- pkg/flagset/common.go | 93 +++++++++++ pkg/flagset/gateway.go | 49 ++++-- pkg/flagset/storagedrivers.go | 178 ++++++++++++++++++++ pkg/flagset/storageeos.go | 264 ++---------------------------- pkg/flagset/storageeosdata.go | 267 ++---------------------------- pkg/flagset/storagehome.go | 262 ++---------------------------- pkg/flagset/storagehomedata.go | 265 ++---------------------------- pkg/flagset/storageoc.go | 265 ++---------------------------- pkg/flagset/storageocdata.go | 268 ++----------------------------- pkg/flagset/storagepubliclink.go | 145 ++++------------- pkg/flagset/storageroot.go | 249 ++-------------------------- 21 files changed, 524 insertions(+), 1933 deletions(-) create mode 100644 pkg/flagset/common.go create mode 100644 pkg/flagset/storagedrivers.go diff --git a/pkg/command/gateway.go b/pkg/command/gateway.go index 08d8201dea..ed8621113a 100644 --- a/pkg/command/gateway.go +++ b/pkg/command/gateway.go @@ -134,18 +134,18 @@ func Gateway(cfg *config.Config) *cli.Command { cfg.Reva.StorageRoot.MountID: cfg.Reva.StorageRoot.URL, cfg.Reva.StorageHome.MountPath: cfg.Reva.StorageHome.URL, // the home storage has no mount id. In responses it returns the mount id of the actual storage - cfg.Reva.StorageEOS.MountPath: cfg.Reva.StorageEOS.URL, - cfg.Reva.StorageEOS.MountID: cfg.Reva.StorageEOS.URL, - cfg.Reva.StorageOC.MountPath: cfg.Reva.StorageOC.URL, - cfg.Reva.StorageOC.MountID: cfg.Reva.StorageOC.URL, - cfg.Reva.StorageS3.MountPath: cfg.Reva.StorageS3.URL, - cfg.Reva.StorageS3.MountID: cfg.Reva.StorageS3.URL, - cfg.Reva.StorageWND.MountPath: cfg.Reva.StorageWND.URL, - cfg.Reva.StorageWND.MountID: cfg.Reva.StorageWND.URL, - cfg.Reva.StorageCustom.MountPath: cfg.Reva.StorageCustom.URL, - cfg.Reva.StorageCustom.MountID: cfg.Reva.StorageCustom.URL, - "/public/": "localhost:10054", - "e1a73ede-549b-4226-abdf-40e69ca8230d": "localhost:10054", + cfg.Reva.StorageEOS.MountPath: cfg.Reva.StorageEOS.URL, + cfg.Reva.StorageEOS.MountID: cfg.Reva.StorageEOS.URL, + cfg.Reva.StorageOC.MountPath: cfg.Reva.StorageOC.URL, + cfg.Reva.StorageOC.MountID: cfg.Reva.StorageOC.URL, + cfg.Reva.StorageS3.MountPath: cfg.Reva.StorageS3.URL, + cfg.Reva.StorageS3.MountID: cfg.Reva.StorageS3.URL, + cfg.Reva.StorageWND.MountPath: cfg.Reva.StorageWND.URL, + cfg.Reva.StorageWND.MountID: cfg.Reva.StorageWND.URL, + cfg.Reva.StorageCustom.MountPath: cfg.Reva.StorageCustom.URL, + cfg.Reva.StorageCustom.MountID: cfg.Reva.StorageCustom.URL, + cfg.Reva.StoragePublicLink.MountPath: cfg.Reva.StoragePublicLink.URL, + cfg.Reva.StoragePublicLink.MountID: cfg.Reva.StoragePublicLink.URL, }, }, }, diff --git a/pkg/command/storageeos.go b/pkg/command/storageeos.go index 04ef99807f..38057f9f7a 100644 --- a/pkg/command/storageeos.go +++ b/pkg/command/storageeos.go @@ -89,7 +89,7 @@ func StorageEOS(cfg *config.Config) *cli.Command { "storageprovider": map[string]interface{}{ "driver": cfg.Reva.StorageEOS.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace, "share_folder": cfg.Reva.Storages.EOS.ShareFolder, @@ -105,16 +105,14 @@ func StorageEOS(cfg *config.Config) *cli.Command { "sec_protocol": cfg.Reva.Storages.EOS.SecProtocol, "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, - "enable_home": cfg.Reva.Storages.EOS.EnableHome, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, }, "mount_path": cfg.Reva.StorageEOS.MountPath, "mount_id": cfg.Reva.StorageEOS.MountID, "expose_data_server": cfg.Reva.StorageEOS.ExposeDataServer, // TODO use cfg.Reva.SStorageEOSData.URL, ? - "data_server_url": cfg.Reva.StorageEOS.DataServerURL, - "enable_home_creation": cfg.Reva.StorageEOS.EnableHomeCreation, + "data_server_url": cfg.Reva.StorageEOS.DataServerURL, }, }, }, diff --git a/pkg/command/storageeosdata.go b/pkg/command/storageeosdata.go index eee78a9253..0522977903 100644 --- a/pkg/command/storageeosdata.go +++ b/pkg/command/storageeosdata.go @@ -91,7 +91,7 @@ func StorageEOSData(cfg *config.Config) *cli.Command { "prefix": cfg.Reva.StorageEOSData.Prefix, "driver": cfg.Reva.StorageEOSData.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace, "share_folder": cfg.Reva.Storages.EOS.ShareFolder, @@ -107,8 +107,7 @@ func StorageEOSData(cfg *config.Config) *cli.Command { "sec_protocol": cfg.Reva.Storages.EOS.SecProtocol, "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, - "enable_home": cfg.Reva.Storages.EOS.EnableHome, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, }, "temp_folder": cfg.Reva.StorageEOSData.TempFolder, diff --git a/pkg/command/storagehome.go b/pkg/command/storagehome.go index 7e0f583a9f..ced6fd5915 100644 --- a/pkg/command/storagehome.go +++ b/pkg/command/storagehome.go @@ -89,7 +89,7 @@ func StorageHome(cfg *config.Config) *cli.Command { "storageprovider": map[string]interface{}{ "driver": cfg.Reva.StorageHome.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace, "share_folder": cfg.Reva.Storages.EOS.ShareFolder, @@ -106,10 +106,16 @@ func StorageHome(cfg *config.Config) *cli.Command { "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, "enable_home": true, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, "local": map[string]interface{}{ - "root": cfg.Reva.Storages.Local.Root, + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + }, + "localhome": map[string]interface{}{ + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + "user_layout": cfg.Reva.Storages.Local.UserLayout, }, "owncloud": map[string]interface{}{ "datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory, @@ -131,8 +137,7 @@ func StorageHome(cfg *config.Config) *cli.Command { "mount_id": cfg.Reva.StorageHome.MountID, "expose_data_server": cfg.Reva.StorageHome.ExposeDataServer, // TODO use cfg.Reva.StorageHomeData.URL, ? - "data_server_url": cfg.Reva.StorageHome.DataServerURL, - "enable_home_creation": cfg.Reva.StorageHome.EnableHomeCreation, + "data_server_url": cfg.Reva.StorageHome.DataServerURL, }, }, }, diff --git a/pkg/command/storagehomedata.go b/pkg/command/storagehomedata.go index a00657bd1f..62ef2c310f 100644 --- a/pkg/command/storagehomedata.go +++ b/pkg/command/storagehomedata.go @@ -91,7 +91,7 @@ func StorageHomeData(cfg *config.Config) *cli.Command { "prefix": cfg.Reva.StorageHomeData.Prefix, "driver": cfg.Reva.StorageHomeData.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "eos_binary": cfg.Reva.Storages.EOS.EosBinary, "shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace, @@ -107,17 +107,21 @@ func StorageHomeData(cfg *config.Config) *cli.Command { "sec_protocol": cfg.Reva.Storages.EOS.SecProtocol, "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, - "enable_home": cfg.Reva.Storages.EOS.EnableHome, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, "local": map[string]interface{}{ - "root": cfg.Reva.Storages.Local.Root, + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + }, + "localhome": map[string]interface{}{ + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + "user_layout": cfg.Reva.Storages.Local.UserLayout, }, "owncloud": map[string]interface{}{ "datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory, "scan": cfg.Reva.Storages.OwnCloud.Scan, "redis": cfg.Reva.Storages.OwnCloud.Redis, - "enable_home": cfg.Reva.Storages.OwnCloud.EnableHome, "user_layout": cfg.Reva.Storages.OwnCloud.Layout, }, "s3": map[string]interface{}{ diff --git a/pkg/command/storageoc.go b/pkg/command/storageoc.go index 34b24e43d1..8b3f536547 100644 --- a/pkg/command/storageoc.go +++ b/pkg/command/storageoc.go @@ -89,7 +89,7 @@ func StorageOC(cfg *config.Config) *cli.Command { "storageprovider": map[string]interface{}{ "driver": cfg.Reva.StorageOC.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace, "share_folder": cfg.Reva.Storages.EOS.ShareFolder, @@ -105,17 +105,21 @@ func StorageOC(cfg *config.Config) *cli.Command { "sec_protocol": cfg.Reva.Storages.EOS.SecProtocol, "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, - "enable_home": cfg.Reva.Storages.EOS.EnableHome, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, "local": map[string]interface{}{ - "root": cfg.Reva.Storages.Local.Root, + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + }, + "localhome": map[string]interface{}{ + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + "user_layout": cfg.Reva.Storages.Local.UserLayout, }, "owncloud": map[string]interface{}{ "datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory, "scan": cfg.Reva.Storages.OwnCloud.Scan, "redis": cfg.Reva.Storages.OwnCloud.Redis, - "enable_home": cfg.Reva.Storages.OwnCloud.EnableHome, "user_layout": cfg.Reva.Storages.OwnCloud.Layout, }, "s3": map[string]interface{}{ @@ -131,8 +135,7 @@ func StorageOC(cfg *config.Config) *cli.Command { "mount_id": cfg.Reva.StorageOC.MountID, "expose_data_server": cfg.Reva.StorageOC.ExposeDataServer, // TODO use cfg.Reva.SStorageOCData.URL, ? - "data_server_url": cfg.Reva.StorageOC.DataServerURL, - "enable_home_creation": cfg.Reva.StorageOC.EnableHomeCreation, + "data_server_url": cfg.Reva.StorageOC.DataServerURL, }, }, }, diff --git a/pkg/command/storageocdata.go b/pkg/command/storageocdata.go index dd3a2be14b..0418f06cfe 100644 --- a/pkg/command/storageocdata.go +++ b/pkg/command/storageocdata.go @@ -91,7 +91,7 @@ func StorageOCData(cfg *config.Config) *cli.Command { "prefix": cfg.Reva.StorageOCData.Prefix, "driver": cfg.Reva.StorageOCData.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace, "share_folder": cfg.Reva.Storages.EOS.ShareFolder, @@ -107,17 +107,21 @@ func StorageOCData(cfg *config.Config) *cli.Command { "sec_protocol": cfg.Reva.Storages.EOS.SecProtocol, "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, - "enable_home": cfg.Reva.Storages.EOS.EnableHome, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, "local": map[string]interface{}{ - "root": cfg.Reva.Storages.Local.Root, + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + }, + "localhome": map[string]interface{}{ + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + "user_layout": cfg.Reva.Storages.Local.UserLayout, }, "owncloud": map[string]interface{}{ "datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory, "scan": cfg.Reva.Storages.OwnCloud.Scan, "redis": cfg.Reva.Storages.OwnCloud.Redis, - "enable_home": cfg.Reva.Storages.OwnCloud.EnableHome, "user_layout": cfg.Reva.Storages.OwnCloud.Layout, }, "s3": map[string]interface{}{ diff --git a/pkg/command/storagepubliclink.go b/pkg/command/storagepubliclink.go index d40313156f..5642897c0b 100644 --- a/pkg/command/storagepubliclink.go +++ b/pkg/command/storagepubliclink.go @@ -68,8 +68,11 @@ func StoragePublicLink(cfg *config.Config) *cli.Command { rcfg := map[string]interface{}{ "core": map[string]interface{}{ - "max_cpus": cfg.Reva.StoragePublicLink.MaxCPUs, - "tracing_enabled": true, + "max_cpus": cfg.Reva.StoragePublicLink.MaxCPUs, + "tracing_enabled": cfg.Tracing.Enabled, + "tracing_endpoint": cfg.Tracing.Endpoint, + "tracing_collector": cfg.Tracing.Collector, + "tracing_service_name": "storage-public-links", }, "shared": map[string]interface{}{ "jwt_secret": cfg.Reva.JWTSecret, diff --git a/pkg/command/storageroot.go b/pkg/command/storageroot.go index a2fa370d06..346fcb98ec 100644 --- a/pkg/command/storageroot.go +++ b/pkg/command/storageroot.go @@ -89,7 +89,7 @@ func StorageRoot(cfg *config.Config) *cli.Command { "storageprovider": map[string]interface{}{ "driver": cfg.Reva.StorageRoot.Driver, "drivers": map[string]interface{}{ - "eos": map[string]interface{}{ + "eoshome": map[string]interface{}{ "namespace": cfg.Reva.Storages.EOS.Namespace, "eos_binary": cfg.Reva.Storages.EOS.EosBinary, "xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary, @@ -103,17 +103,21 @@ func StorageRoot(cfg *config.Config) *cli.Command { "sec_protocol": cfg.Reva.Storages.EOS.SecProtocol, "keytab": cfg.Reva.Storages.EOS.Keytab, "single_username": cfg.Reva.Storages.EOS.SingleUsername, - "enable_home": cfg.Reva.Storages.EOS.EnableHome, - "user_layout": cfg.Reva.Storages.EOS.Layout, + "user_layout": cfg.Reva.Storages.EOS.UserLayout, }, "local": map[string]interface{}{ - "root": cfg.Reva.Storages.Local.Root, + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + }, + "localhome": map[string]interface{}{ + "root": cfg.Reva.Storages.Local.Root, + "share_folder": cfg.Reva.Storages.Local.ShareFolder, + "user_layout": cfg.Reva.Storages.Local.UserLayout, }, "owncloud": map[string]interface{}{ "datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory, "scan": cfg.Reva.Storages.OwnCloud.Scan, "redis": cfg.Reva.Storages.OwnCloud.Redis, - "enable_home": cfg.Reva.Storages.OwnCloud.EnableHome, "user_layout": cfg.Reva.Storages.OwnCloud.Layout, }, "s3": map[string]interface{}{ @@ -125,11 +129,10 @@ func StorageRoot(cfg *config.Config) *cli.Command { "prefix": cfg.Reva.Storages.S3.Prefix, }, }, - "mount_path": cfg.Reva.StorageRoot.MountPath, - "mount_id": cfg.Reva.StorageRoot.MountID, - "expose_data_server": cfg.Reva.StorageRoot.ExposeDataServer, - "data_server_url": cfg.Reva.StorageRoot.DataServerURL, - "enable_home_creation": cfg.Reva.StorageRoot.EnableHomeCreation, + "mount_path": cfg.Reva.StorageRoot.MountPath, + "mount_id": cfg.Reva.StorageRoot.MountID, + "expose_data_server": cfg.Reva.StorageRoot.ExposeDataServer, + "data_server_url": cfg.Reva.StorageRoot.DataServerURL, }, }, }, diff --git a/pkg/config/config.go b/pkg/config/config.go index 942b48b767..804a5b9696 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -68,12 +68,11 @@ type Users struct { // StoragePort defines the available storage configuration. type StoragePort struct { Port - Driver string - MountPath string - MountID string - ExposeDataServer bool - DataServerURL string - EnableHomeCreation bool + Driver string + MountPath string + MountID string + ExposeDataServer bool + DataServerURL string // for HTTP ports with only one http service Prefix string @@ -85,9 +84,7 @@ type PublicStorage struct { StoragePort PublicShareProviderAddr string - StorageProviderAddr string UserProviderAddr string - MountID string } // StorageConfig combines all available storage driver configuration parts. @@ -145,9 +142,6 @@ type DriverEOS struct { // UseKeyTabAuth changes will authenticate requests by using an EOS keytab. UseKeytab bool - // EnableHome enables the creation of home directories. - EnableHome bool - // SecProtocol specifies the xrootd security protocol to use between the server and EOS. SecProtocol string @@ -157,13 +151,15 @@ type DriverEOS struct { // SingleUsername is the username to use when SingleUserMode is enabled SingleUsername string - // Layout of the users home dir path - Layout string + // UserLayout of the users home dir path + UserLayout string } // DriverLocal defines the available local storage driver configuration. type DriverLocal struct { - Root string + Root string + ShareFolder string + UserLayout string } // DriverOwnCloud defines the available ownCloud storage driver configuration. @@ -172,7 +168,6 @@ type DriverOwnCloud struct { Layout string Redis string Scan bool - EnableHome bool } // DriverS3 defines the available S3 storage driver configuration. diff --git a/pkg/flagset/common.go b/pkg/flagset/common.go new file mode 100644 index 0000000000..ad3c1e8f09 --- /dev/null +++ b/pkg/flagset/common.go @@ -0,0 +1,93 @@ +package flagset + +import ( + "github.com/micro/cli/v2" + "github.com/owncloud/ocis-reva/pkg/config" +) + +func commonTracingWithConfig(cfg *config.Config) []cli.Flag { + return []cli.Flag{ + &cli.BoolFlag{ + Name: "tracing-enabled", + Usage: "Enable sending traces", + EnvVars: []string{"REVA_TRACING_ENABLED"}, + Destination: &cfg.Tracing.Enabled, + }, + &cli.StringFlag{ + Name: "tracing-type", + Value: "jaeger", + Usage: "Tracing backend type", + EnvVars: []string{"REVA_TRACING_TYPE"}, + Destination: &cfg.Tracing.Type, + }, + &cli.StringFlag{ + Name: "tracing-endpoint", + Value: "", + Usage: "Endpoint for the agent", + EnvVars: []string{"REVA_TRACING_ENDPOINT"}, + Destination: &cfg.Tracing.Endpoint, + }, + &cli.StringFlag{ + Name: "tracing-collector", + Value: "", + Usage: "Endpoint for the collector", + EnvVars: []string{"REVA_TRACING_COLLECTOR"}, + Destination: &cfg.Tracing.Collector, + }, + &cli.StringFlag{ + Name: "tracing-service", + Value: "reva", + Usage: "Service name for tracing", + EnvVars: []string{"REVA_TRACING_SERVICE"}, + Destination: &cfg.Tracing.Service, + }, + } +} + +func commonDebugWithConfig(cfg *config.Config) []cli.Flag { + return []cli.Flag{ + &cli.StringFlag{ + Name: "debug-token", + Value: "", + Usage: "Token to grant metrics access", + EnvVars: []string{"REVA_DEBUG_TOKEN"}, + Destination: &cfg.Debug.Token, + }, + &cli.BoolFlag{ + Name: "debug-pprof", + Usage: "Enable pprof debugging", + EnvVars: []string{"REVA_DEBUG_PPROF"}, + Destination: &cfg.Debug.Pprof, + }, + &cli.BoolFlag{ + Name: "debug-zpages", + Usage: "Enable zpages debugging", + EnvVars: []string{"REVA_DEBUG_ZPAGES"}, + Destination: &cfg.Debug.Zpages, + }, + } +} + +func commonSecretWithConfig(cfg *config.Config) []cli.Flag { + return []cli.Flag{ + &cli.StringFlag{ + Name: "jwt-secret", + Value: "Pive-Fumkiu4", + Usage: "Shared jwt secret for reva service communication", + EnvVars: []string{"REVA_JWT_SECRET"}, + Destination: &cfg.Reva.JWTSecret, + }, + } +} + +func commonGatewayWithConfig(cfg *config.Config) []cli.Flag { + return []cli.Flag{ + &cli.StringFlag{ + Name: "gateway-url", + Value: "localhost:9142", + Usage: "URL to use for the reva gateway service", + EnvVars: []string{"REVA_GATEWAY_URL"}, + Destination: &cfg.Reva.Gateway.URL, + }, + } +} diff --git a/pkg/flagset/gateway.go b/pkg/flagset/gateway.go index 73b59be376..1d80b5fb51 100644 --- a/pkg/flagset/gateway.go +++ b/pkg/flagset/gateway.go @@ -189,7 +189,7 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.StringFlag{ Name: "frontend-url", Value: "https://localhost:9200", - Usage: "URL to use for the reva service", + Usage: "URL to use for the frontend service", EnvVars: []string{"REVA_FRONTEND_URL"}, Destination: &cfg.Reva.Frontend.URL, }, @@ -203,28 +203,28 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.StringFlag{ Name: "users-url", Value: "localhost:9144", - Usage: "URL to use for the reva service", + Usage: "URL to use for the users service", EnvVars: []string{"REVA_USERS_URL"}, Destination: &cfg.Reva.Users.URL, }, &cli.StringFlag{ Name: "auth-basic-url", Value: "localhost:9146", - Usage: "URL to use for the reva service", + Usage: "URL to use for the auth basic service", EnvVars: []string{"REVA_AUTH_BASIC_URL"}, Destination: &cfg.Reva.AuthBasic.URL, }, &cli.StringFlag{ Name: "auth-bearer-url", Value: "localhost:9148", - Usage: "URL to use for the reva service", + Usage: "URL to use for the auth bearer service", EnvVars: []string{"REVA_AUTH_BEARER_URL"}, Destination: &cfg.Reva.AuthBearer.URL, }, &cli.StringFlag{ Name: "sharing-url", Value: "localhost:9150", - Usage: "URL to use for the reva service", + Usage: "URL to use for the sharing service", EnvVars: []string{"REVA_SHARING_URL"}, Destination: &cfg.Reva.Sharing.URL, }, @@ -232,21 +232,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.StringFlag{ Name: "storage-root-url", Value: "localhost:9152", - Usage: "URL to use for the reva service", + Usage: "URL to use for the root storage service", EnvVars: []string{"REVA_STORAGE_ROOT_URL"}, Destination: &cfg.Reva.StorageRoot.URL, }, &cli.StringFlag{ Name: "storage-root-mount-path", Value: "/", - Usage: "mount path", + Usage: "root storage mount path", EnvVars: []string{"REVA_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", + Usage: "root storage mount id", EnvVars: []string{"REVA_STORAGE_ROOT_MOUNT_ID"}, Destination: &cfg.Reva.StorageRoot.MountID, }, @@ -254,14 +254,14 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.StringFlag{ Name: "storage-home-url", Value: "localhost:9154", - Usage: "URL to use for the reva service", + Usage: "URL to use for the home storage service", EnvVars: []string{"REVA_STORAGE_HOME_URL"}, Destination: &cfg.Reva.StorageHome.URL, }, &cli.StringFlag{ Name: "storage-home-mount-path", Value: "/home", - Usage: "mount path", + Usage: "home storage mount path", EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_PATH"}, Destination: &cfg.Reva.StorageHome.MountPath, }, @@ -270,21 +270,21 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.StringFlag{ Name: "storage-eos-url", Value: "localhost:9158", - Usage: "URL to use for the reva service", + Usage: "URL to use for the eos storage service", EnvVars: []string{"REVA_STORAGE_EOS_URL"}, Destination: &cfg.Reva.StorageEOS.URL, }, &cli.StringFlag{ Name: "storage-eos-mount-path", Value: "/eos", - Usage: "mount path", + Usage: "eos storage mount path", EnvVars: []string{"REVA_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", + Usage: "eos storage mount id", EnvVars: []string{"REVA_STORAGE_EOS_MOUNT_ID"}, Destination: &cfg.Reva.StorageEOS.MountID, }, @@ -292,30 +292,45 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag { &cli.StringFlag{ Name: "storage-oc-url", Value: "localhost:9162", - Usage: "URL to use for the reva service", + Usage: "URL to use for the oc storage service", EnvVars: []string{"REVA_STORAGE_OC_URL"}, Destination: &cfg.Reva.StorageOC.URL, }, &cli.StringFlag{ Name: "storage-oc-mount-path", Value: "/oc", - Usage: "mount path", + Usage: "oc storage mount path", EnvVars: []string{"REVA_STORAGE_OC_MOUNT_PATH"}, Destination: &cfg.Reva.StorageOC.MountPath, }, &cli.StringFlag{ Name: "storage-oc-mount-id", Value: "1284d238-aa92-42ce-bdc4-0b0000009162", - Usage: "mount id", + Usage: "oc storage mount id", EnvVars: []string{"REVA_STORAGE_OC_MOUNT_ID"}, Destination: &cfg.Reva.StorageOC.MountID, }, + &cli.StringFlag{ Name: "public-links-url", - Value: "localhost:10054", + Value: "localhost:9170", Usage: "URL to use for the public links service", EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_URL"}, Destination: &cfg.Reva.StoragePublicLink.URL, }, + &cli.StringFlag{ + Name: "public-links-mount-path", + Value: "/public/", + Usage: "public links storage mount path", + EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_PATH"}, + Destination: &cfg.Reva.StoragePublicLink.MountPath, + }, + &cli.StringFlag{ + Name: "public-links-mount-id", + Value: "e1a73ede-549b-4226-abdf-40e69ca8230d", + Usage: "public links storage mount id", + EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_ID"}, + Destination: &cfg.Reva.StoragePublicLink.MountID, + }, } } diff --git a/pkg/flagset/storagedrivers.go b/pkg/flagset/storagedrivers.go new file mode 100644 index 0000000000..f8dc1279f0 --- /dev/null +++ b/pkg/flagset/storagedrivers.go @@ -0,0 +1,178 @@ +package flagset + +import ( + "os" + + "github.com/micro/cli/v2" + "github.com/owncloud/ocis-reva/pkg/config" +) + +// StorageDriversWithConfig applies cfg to the root flagset +func storageDriversWithConfig(cfg *config.Config) []cli.Flag { + return []cli.Flag{ + + // Eos + + &cli.StringFlag{ + Name: "storage-eos-namespace", + Value: "/eos/dockertest/reva/users", + Usage: "Namespace for metadata operations", + EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, + Destination: &cfg.Reva.Storages.EOS.Namespace, + }, + &cli.StringFlag{ + Name: "storage-eos-shadow-namespace", + // Defaults to path.Join(c.Namespace, ".shadow") + Usage: "Shadow namespace where share references are stored", + EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, + Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, + }, + &cli.StringFlag{ + Name: "storage-eos-share-folder", + Value: "/Shares", + Usage: "name of the share folder", + EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, + Destination: &cfg.Reva.Storages.EOS.ShareFolder, + }, + &cli.StringFlag{ + Name: "storage-eos-binary", + Value: "/usr/bin/eos", + Usage: "Location of the eos binary", + EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, + Destination: &cfg.Reva.Storages.EOS.EosBinary, + }, + &cli.StringFlag{ + Name: "storage-eos-xrdcopy-binary", + Value: "/usr/bin/xrdcopy", + Usage: "Location of the xrdcopy binary", + EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, + Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, + }, + &cli.StringFlag{ + Name: "storage-eos-master-url", + Value: "root://eos-mgm1.eoscluster.cern.ch:1094", + Usage: "URL of the Master EOS MGM", + EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, + Destination: &cfg.Reva.Storages.EOS.MasterURL, + }, + &cli.StringFlag{ + Name: "storage-eos-slave-url", + Value: "root://eos-mgm1.eoscluster.cern.ch:1094", + Usage: "URL of the Slave EOS MGM", + EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, + Destination: &cfg.Reva.Storages.EOS.SlaveURL, + }, + &cli.StringFlag{ + Name: "storage-eos-cache-directory", + Value: os.TempDir(), + Usage: "Location on the local fs where to store reads", + EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, + Destination: &cfg.Reva.Storages.EOS.CacheDirectory, + }, + &cli.BoolFlag{ + Name: "storage-eos-enable-logging", + Value: true, + Usage: "Enables logging of the commands executed", + EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, + Destination: &cfg.Reva.Storages.EOS.EnableLogging, + }, + &cli.BoolFlag{ + Name: "storage-eos-show-hidden-sysfiles", + Usage: "show internal EOS files like .sys.v# and .sys.a# files.", + EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, + Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, + }, + &cli.BoolFlag{ + Name: "storage-eos-force-singleuser-mode", + Usage: "force connections to EOS to use SingleUsername", + EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, + Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, + }, + &cli.BoolFlag{ + Name: "storage-eos-use-keytab", + Usage: "authenticate requests by using an EOS keytab", + EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, + Destination: &cfg.Reva.Storages.EOS.UseKeytab, + }, + &cli.StringFlag{ + Name: "storage-eos-sec-protocol", + Usage: "the xrootd security protocol to use between the server and EOS", + EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, + Destination: &cfg.Reva.Storages.EOS.SecProtocol, + }, + &cli.StringFlag{ + Name: "storage-eos-keytab", + Usage: "the location of the keytab to use to authenticate to EOS", + EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, + Destination: &cfg.Reva.Storages.EOS.Keytab, + }, + &cli.StringFlag{ + Name: "storage-eos-single-username", + Usage: "the username to use when SingleUserMode is enabled", + EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, + Destination: &cfg.Reva.Storages.EOS.SingleUsername, + }, + &cli.StringFlag{ + Name: "storage-eos-user-layout", + Value: "{{substr 0 1 .Username}}/{{.Username}}", + Usage: `"layout of the users internal home dir path, in addition to {{.Username}}, and {{.Mail}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "E/Einstein" `, + EnvVars: []string{"REVA_STORAGE_EOS_USER_LAYOUT"}, + Destination: &cfg.Reva.Storages.EOS.UserLayout, + }, + + // local + + &cli.StringFlag{ + Name: "storage-local-root", + Value: "/var/tmp/reva/root", + Usage: "the path to the local storage root", + EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, + Destination: &cfg.Reva.Storages.Local.Root, + }, + &cli.StringFlag{ + Name: "storage-local-share-folder", + Value: "/MyShares", + Usage: "name of the share folder", + EnvVars: []string{"REVA_STORAGE_LOCAL_SHARE_FOLDER"}, + Destination: &cfg.Reva.Storages.Local.UserLayout, + }, + &cli.StringFlag{ + Name: "storage-local-user-layout", + Value: "{{substr 0 1 .Username}}/{{.Username}}", + Usage: `"layout of the users internal home dir path, in addition to {{.Username}}, and {{.Mail}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "E/Einstein" `, + EnvVars: []string{"REVA_STORAGE_LOCAL_USER_LAYOUT"}, + Destination: &cfg.Reva.Storages.Local.UserLayout, + }, + + // owncloud + + &cli.StringFlag{ + Name: "storage-owncloud-datadir", + Value: "/var/tmp/reva/data", + Usage: "the path to the owncloud data directory", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, + Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, + }, + &cli.BoolFlag{ + Name: "storage-owncloud-scan", + Value: true, + Usage: "scan files on startup to add fileids", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, + Destination: &cfg.Reva.Storages.OwnCloud.Scan, + }, + &cli.StringFlag{ + Name: "storage-owncloud-redis", + Value: ":6379", + Usage: "the address of the redis server", + EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, + Destination: &cfg.Reva.Storages.OwnCloud.Redis, + }, + &cli.StringFlag{ + Name: "storage-owncloud-layout", + Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, + Destination: &cfg.Reva.Storages.OwnCloud.Layout, + }, + } +} diff --git a/pkg/flagset/storageeos.go b/pkg/flagset/storageeos.go index e30283254a..8247b17d90 100644 --- a/pkg/flagset/storageeos.go +++ b/pkg/flagset/storageeos.go @@ -1,92 +1,21 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageEOSWithConfig applies cfg to the root flagset func StorageEOSWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // 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{"REVA_STORAGE_EOS_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageEOS.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonDebugWithConfig(cfg)...) - // REVA + flags = append(flags, storageDriversWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, - - // Services - - // Storage oc + flags = append(flags, &cli.StringFlag{ Name: "network", @@ -109,6 +38,13 @@ func StorageEOSWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_EOS_ADDR"}, Destination: &cfg.Reva.StorageEOS.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9159", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_EOS_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageEOS.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9158", @@ -122,10 +58,9 @@ func StorageEOSWithConfig(cfg *config.Config) []cli.Flag { Usage: "--service storageprovider [--service otherservice]", EnvVars: []string{"REVA_STORAGE_EOS_SERVICES"}, }, - &cli.StringFlag{ Name: "driver", - Value: "eos", + Value: "eoshome", Usage: "storage driver, eg. local, eos, owncloud or s3", EnvVars: []string{"REVA_STORAGE_EOS_DRIVER"}, Destination: &cfg.Reva.StorageEOS.Driver, @@ -158,176 +93,7 @@ func StorageEOSWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_EOS_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageEOS.DataServerURL, }, - &cli.BoolFlag{ - Name: "enable-home-creation", - Value: false, - Usage: "if enabled home dirs will be automatically created", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME_CREATION"}, - Destination: &cfg.Reva.StorageEOS.EnableHomeCreation, - }, + ) - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "/eos/dockertest/reva", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-shadow-namespace", - // Defaults to path.Join(c.Namespace, ".shadow") - Usage: "Shadow namespace where share references are stored", - EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, - }, - &cli.StringFlag{ - Name: "storage-eos-share-folder", - Value: "/Shares", - Usage: "name of the share folder", - EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.Storages.EOS.ShareFolder, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: false, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - } + return flags } diff --git a/pkg/flagset/storageeosdata.go b/pkg/flagset/storageeosdata.go index 10d651c508..583f5773b5 100644 --- a/pkg/flagset/storageeosdata.go +++ b/pkg/flagset/storageeosdata.go @@ -1,92 +1,23 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageEOSDataWithConfig applies cfg to the root flagset func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonGatewayWithConfig(cfg)...) - // 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{"REVA_STORAGE_OC_DATA_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageEOSData.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // REVA + flags = append(flags, commonDebugWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, + flags = append(flags, storageDriversWithConfig(cfg)...) - // Services - - // Storage eos data + flags = append(flags, &cli.StringFlag{ Name: "network", @@ -109,6 +40,13 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_EOS_DATA_ADDR"}, Destination: &cfg.Reva.StorageEOSData.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9161", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_OC_DATA_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageEOSData.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9160", @@ -124,7 +62,7 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag { }, &cli.StringFlag{ Name: "driver", - Value: "eos", + Value: "eoshome", Usage: "storage driver, eg. local, eos, owncloud or s3", EnvVars: []string{"REVA_STORAGE_EOS_DATA_DRIVER"}, Destination: &cfg.Reva.StorageEOSData.Driver, @@ -143,179 +81,6 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_EOS_DATA_TEMP_FOLDER"}, Destination: &cfg.Reva.StorageEOSData.TempFolder, }, - - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "/eos/dockertest/reva", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-shadow-namespace", - // Defaults to path.Join(c.Namespace, ".shadow") - Usage: "Shadow namespace where share references are stored", - EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, - }, - &cli.StringFlag{ - Name: "storage-eos-share-folder", - Value: "/Shares", - Usage: "name of the share folder", - EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.Storages.EOS.ShareFolder, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: false, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - - // Gateway - - &cli.StringFlag{ - Name: "gateway-url", - Value: "localhost:9142", - Usage: "URL to use for the reva gateway service", - EnvVars: []string{"REVA_GATEWAY_URL"}, - Destination: &cfg.Reva.Gateway.URL, - }, - } + ) + return flags } diff --git a/pkg/flagset/storagehome.go b/pkg/flagset/storagehome.go index 4c5cc8d506..6737f3417b 100644 --- a/pkg/flagset/storagehome.go +++ b/pkg/flagset/storagehome.go @@ -1,92 +1,21 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageHomeWithConfig applies cfg to the root flagset func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // debug ports are the odd ports - &cli.StringFlag{ - Name: "debug-addr", - Value: "0.0.0.0:9155", - Usage: "Address to bind debug server", - EnvVars: []string{"REVA_STORAGE_HOME_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageHome.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonDebugWithConfig(cfg)...) - // REVA + flags = append(flags, storageDriversWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, - - // Services - - // Storage home + flags = append(flags, &cli.StringFlag{ Name: "network", @@ -109,6 +38,13 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_HOME_ADDR"}, Destination: &cfg.Reva.StorageHome.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9155", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_HOME_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageHome.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9154", @@ -160,177 +96,7 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_HOME_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageHome.DataServerURL, }, - &cli.BoolFlag{ - Name: "enable-home-creation", - Value: true, - Usage: "if enabled home dirs will be automatically created", - EnvVars: []string{"REVA_STORAGE_HOME_ENABLE_HOME_CREATION"}, - Destination: &cfg.Reva.StorageHome.EnableHomeCreation, - }, + ) - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "/eos/dockertest/reva/users", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-shadow-namespace", - // Defaults to path.Join(c.Namespace, ".shadow") - Usage: "Shadow namespace where share references are stored", - EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, - }, - &cli.StringFlag{ - Name: "storage-eos-share-folder", - Value: "/Shares", - Usage: "name of the share folder", - EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.Storages.EOS.ShareFolder, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Value: true, - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "E/Einstein" `, - EnvVars: []string{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: true, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - } + return flags } diff --git a/pkg/flagset/storagehomedata.go b/pkg/flagset/storagehomedata.go index 8b8393a651..026b166b94 100644 --- a/pkg/flagset/storagehomedata.go +++ b/pkg/flagset/storagehomedata.go @@ -1,92 +1,23 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageHomeDataWithConfig applies cfg to the root flagset func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonGatewayWithConfig(cfg)...) - // 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{"REVA_STORAGE_HOME_DATA_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageHomeData.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // REVA + flags = append(flags, commonDebugWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, + flags = append(flags, storageDriversWithConfig(cfg)...) - // Services - - // Storage home data + flags = append(flags, &cli.StringFlag{ Name: "network", @@ -109,6 +40,13 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_HOME_DATA_ADDR"}, Destination: &cfg.Reva.StorageHomeData.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9157", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_HOME_DATA_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageHomeData.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9156", @@ -143,180 +81,7 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_HOME_DATA_TEMP_FOLDER"}, Destination: &cfg.Reva.StorageHomeData.TempFolder, }, + ) - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "/eos/dockertest/reva/users", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-shadow-namespace", - // Defaults to path.Join(c.Namespace, ".shadow") - Usage: "Shadow namespace where share references are stored", - EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, - }, - &cli.StringFlag{ - Name: "storage-eos-share-folder", - Value: "/Shares", - Usage: "name of the share folder", - EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.Storages.EOS.ShareFolder, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-mgm1.eoscluster.cern.ch:1094", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Value: true, - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "E/Einstein" `, - EnvVars: []string{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: true, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - - // Gateway - - &cli.StringFlag{ - Name: "gateway-url", - Value: "localhost:9142", - Usage: "URL to use for the reva gateway service", - EnvVars: []string{"REVA_GATEWAY_URL"}, - Destination: &cfg.Reva.Gateway.URL, - }, - } + return flags } diff --git a/pkg/flagset/storageoc.go b/pkg/flagset/storageoc.go index 62d58bccbe..c8322db5e6 100644 --- a/pkg/flagset/storageoc.go +++ b/pkg/flagset/storageoc.go @@ -1,92 +1,21 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageOCWithConfig applies cfg to the root flagset func StorageOCWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // 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{"REVA_STORAGE_OC_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageOC.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonDebugWithConfig(cfg)...) - // REVA + flags = append(flags, storageDriversWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, - - // Services - - // Storage oc + flags = append(flags, &cli.StringFlag{ Name: "network", @@ -109,6 +38,13 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_OC_ADDR"}, Destination: &cfg.Reva.StorageOC.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9163", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_OC_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageOC.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9162", @@ -122,7 +58,6 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { Usage: "--service storageprovider [--service otherservice]", EnvVars: []string{"REVA_STORAGE_OC_SERVICES"}, }, - &cli.StringFlag{ Name: "driver", Value: "owncloud", @@ -158,179 +93,7 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_OC_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageOC.DataServerURL, }, - &cli.BoolFlag{ - Name: "enable-home-creation", - Value: false, - Usage: "if enabled home dirs will be automatically created", - EnvVars: []string{"REVA_STORAGE_OC_ENABLE_HOME_CREATION"}, - Destination: &cfg.Reva.StorageOC.EnableHomeCreation, - }, + ) - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-shadow-namespace", - // Defaults to path.Join(c.Namespace, ".shadow") - Usage: "Shadow namespace where share references are stored", - EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, - }, - &cli.StringFlag{ - Name: "storage-eos-share-folder", - Value: "", - Usage: "name of the share folder", - EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.Storages.EOS.ShareFolder, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-example.org", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-example.org", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Value: "", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Value: "", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Value: "", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: false, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - } + return flags } diff --git a/pkg/flagset/storageocdata.go b/pkg/flagset/storageocdata.go index bb2a645adb..a228d712be 100644 --- a/pkg/flagset/storageocdata.go +++ b/pkg/flagset/storageocdata.go @@ -1,93 +1,23 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageOCDataWithConfig applies cfg to the root flagset func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonGatewayWithConfig(cfg)...) - // 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{"REVA_STORAGE_OC_DATA_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageOCData.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // REVA + flags = append(flags, commonDebugWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, - - // Services - - // Storage oc data + flags = append(flags, storageDriversWithConfig(cfg)...) + flags = append(flags, &cli.StringFlag{ Name: "network", Value: "tcp", @@ -109,6 +39,13 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_OC_DATA_ADDR"}, Destination: &cfg.Reva.StorageOCData.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9165", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_OC_DATA_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageOCData.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9164", @@ -143,182 +80,7 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_OC_DATA_TEMP_FOLDER"}, Destination: &cfg.Reva.StorageOCData.TempFolder, }, + ) - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-shadow-namespace", - // Defaults to path.Join(c.Namespace, ".shadow") - Usage: "Shadow namespace where share references are stored", - EnvVars: []string{"REVA_STORAGE_EOS_SHADOW_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.ShadowNamespace, - }, - &cli.StringFlag{ - Name: "storage-eos-share-folder", - Value: "", - Usage: "name of the share folder", - EnvVars: []string{"REVA_STORAGE_EOS_SHARE_FOLDER"}, - Destination: &cfg.Reva.Storages.EOS.ShareFolder, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-example.org", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-example.org", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Value: "", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Value: "", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Value: "", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: false, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - - // Gateway - - &cli.StringFlag{ - Name: "gateway-url", - Value: "localhost:9142", - Usage: "URL to use for the reva gateway service", - EnvVars: []string{"REVA_GATEWAY_URL"}, - Destination: &cfg.Reva.Gateway.URL, - }, - } + return flags } diff --git a/pkg/flagset/storagepubliclink.go b/pkg/flagset/storagepubliclink.go index a665d959f7..3d0d57fd0c 100644 --- a/pkg/flagset/storagepubliclink.go +++ b/pkg/flagset/storagepubliclink.go @@ -7,74 +7,17 @@ import ( // StoragePublicLink applies cfg to the root flagset func StoragePublicLink(cfg *config.Config) []cli.Flag { - return []cli.Flag{ - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, - &cli.StringFlag{ - Name: "debug-addr", - Value: "0.0.0.0:10053", - Usage: "Address to bind debug server", - EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_DEBUG_ADDR"}, - Destination: &cfg.Reva.StoragePublicLink.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, + flags := commonTracingWithConfig(cfg) + + flags = append(flags, commonGatewayWithConfig(cfg)...) + + flags = append(flags, commonSecretWithConfig(cfg)...) + + flags = append(flags, commonDebugWithConfig(cfg)...) + + flags = append(flags, storageDriversWithConfig(cfg)...) + + flags = append(flags, &cli.StringFlag{ Name: "network", Value: "tcp", @@ -91,11 +34,25 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag { }, &cli.StringFlag{ Name: "addr", - Value: "localhost:10054", + Value: "0.0.0.0:9170", Usage: "Address to bind reva service", EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_ADDR"}, Destination: &cfg.Reva.StoragePublicLink.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9171", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_DEBUG_ADDR"}, + Destination: &cfg.Reva.StoragePublicLink.DebugAddr, + }, + &cli.StringFlag{ + Name: "url", + Value: "localhost:9170", + Usage: "URL to use for the reva service", + EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_URL"}, + Destination: &cfg.Reva.StoragePublicLink.URL, + }, &cli.StringSliceFlag{ Name: "service", Value: cli.NewStringSlice("storageprovider"), @@ -118,18 +75,11 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag { Destination: &cfg.Reva.StoragePublicLink.UserProviderAddr, }, &cli.StringFlag{ - Name: "storage_provider_addr", - Value: "localhost:9154", - Usage: "storage provider service address", - EnvVars: []string{"REVA_STORAGE_PUBLICLINK_STORAGE_PROVIDER_ADDR"}, - Destination: &cfg.Reva.StoragePublicLink.StorageProviderAddr, - }, - &cli.StringFlag{ - Name: "driver", - Value: "owncloud", - Usage: "storage driver, eg. local, eos, owncloud or s3", - EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_DRIVER"}, - Destination: &cfg.Reva.StoragePublicLink.Driver, + Name: "mount-path", + Value: "/public/", + Usage: "mount path", + EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_PATH"}, + Destination: &cfg.Reva.StoragePublicLink.MountPath, }, &cli.StringFlag{ Name: "mount-id", @@ -145,33 +95,8 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_EXPOSE_DATA_SERVER"}, Destination: &cfg.Reva.StoragePublicLink.ExposeDataServer, }, - &cli.StringFlag{ - Name: "data-server-url", - Value: "http://localhost:9156/data", - Usage: "data server url", - EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_DATA_SERVER_URL"}, - Destination: &cfg.Reva.StoragePublicLink.DataServerURL, - }, - &cli.BoolFlag{ - Name: "enable-home-creation", - Value: true, - Usage: "if enabled home dirs will be automatically created", - EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_ENABLE_HOME_CREATION"}, - Destination: &cfg.Reva.StoragePublicLink.EnableHomeCreation, - }, - &cli.StringFlag{ - Name: "mount-path", - Value: "/public/", - Usage: "mount path", - EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_PATH"}, - Destination: &cfg.Reva.StoragePublicLink.MountPath, - }, - &cli.StringFlag{ - Name: "gateway-url", - Value: "localhost:9142", - Usage: "URL to use for the reva gateway service", - EnvVars: []string{"REVA_GATEWAY_URL"}, - Destination: &cfg.Reva.Gateway.URL, - }, - } + // has no data provider, only redirects to the actual storage + ) + + return flags } diff --git a/pkg/flagset/storageroot.go b/pkg/flagset/storageroot.go index 31b136d762..03a6cc7c26 100644 --- a/pkg/flagset/storageroot.go +++ b/pkg/flagset/storageroot.go @@ -1,92 +1,21 @@ package flagset import ( - "os" - "github.com/micro/cli/v2" "github.com/owncloud/ocis-reva/pkg/config" ) // StorageRootWithConfig applies cfg to the root flagset func StorageRootWithConfig(cfg *config.Config) []cli.Flag { - return []cli.Flag{ + flags := commonTracingWithConfig(cfg) - &cli.BoolFlag{ - Name: "tracing-enabled", - Usage: "Enable sending traces", - EnvVars: []string{"REVA_TRACING_ENABLED"}, - Destination: &cfg.Tracing.Enabled, - }, - &cli.StringFlag{ - Name: "tracing-type", - Value: "jaeger", - Usage: "Tracing backend type", - EnvVars: []string{"REVA_TRACING_TYPE"}, - Destination: &cfg.Tracing.Type, - }, - &cli.StringFlag{ - Name: "tracing-endpoint", - Value: "", - Usage: "Endpoint for the agent", - EnvVars: []string{"REVA_TRACING_ENDPOINT"}, - Destination: &cfg.Tracing.Endpoint, - }, - &cli.StringFlag{ - Name: "tracing-collector", - Value: "", - Usage: "Endpoint for the collector", - EnvVars: []string{"REVA_TRACING_COLLECTOR"}, - Destination: &cfg.Tracing.Collector, - }, - &cli.StringFlag{ - Name: "tracing-service", - Value: "reva", - Usage: "Service name for tracing", - EnvVars: []string{"REVA_TRACING_SERVICE"}, - Destination: &cfg.Tracing.Service, - }, + flags = append(flags, commonSecretWithConfig(cfg)...) - // 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{"REVA_STORAGE_ROOT_DEBUG_ADDR"}, - Destination: &cfg.Reva.StorageRoot.DebugAddr, - }, - &cli.StringFlag{ - Name: "debug-token", - Value: "", - Usage: "Token to grant metrics access", - EnvVars: []string{"REVA_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - &cli.BoolFlag{ - Name: "debug-pprof", - Usage: "Enable pprof debugging", - EnvVars: []string{"REVA_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - &cli.BoolFlag{ - Name: "debug-zpages", - Usage: "Enable zpages debugging", - EnvVars: []string{"REVA_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, + flags = append(flags, commonDebugWithConfig(cfg)...) - // REVA + flags = append(flags, storageDriversWithConfig(cfg)...) - &cli.StringFlag{ - Name: "jwt-secret", - Value: "Pive-Fumkiu4", - Usage: "Shared jwt secret for reva service communication", - EnvVars: []string{"REVA_JWT_SECRET"}, - Destination: &cfg.Reva.JWTSecret, - }, - - // Services - - // Storage root + flags = append(flags, &cli.StringFlag{ Name: "network", @@ -109,6 +38,13 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_ROOT_ADDR"}, Destination: &cfg.Reva.StorageRoot.Addr, }, + &cli.StringFlag{ + Name: "debug-addr", + Value: "0.0.0.0:9153", + Usage: "Address to bind debug server", + EnvVars: []string{"REVA_STORAGE_ROOT_DEBUG_ADDR"}, + Destination: &cfg.Reva.StorageRoot.DebugAddr, + }, &cli.StringFlag{ Name: "url", Value: "localhost:9152", @@ -157,164 +93,7 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag { EnvVars: []string{"REVA_STORAGE_ROOT_DATA_SERVER_URL"}, Destination: &cfg.Reva.StorageRoot.DataServerURL, }, - &cli.BoolFlag{ - Name: "enable-home-creation", - Usage: "if enabled home dirs will be automatically created", - EnvVars: []string{"REVA_STORAGE_HOME_ENABLE_HOME_CREATION"}, - Destination: &cfg.Reva.StorageHome.EnableHomeCreation, - }, + ) - // Storage drivers - - // Eos - - &cli.StringFlag{ - Name: "storage-eos-namespace", - Value: "", - Usage: "Namespace for metadata operations", - EnvVars: []string{"REVA_STORAGE_EOS_NAMESPACE"}, - Destination: &cfg.Reva.Storages.EOS.Namespace, - }, - &cli.StringFlag{ - Name: "storage-eos-binary", - Value: "/usr/bin/eos", - Usage: "Location of the eos binary", - EnvVars: []string{"REVA_STORAGE_EOS_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.EosBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-xrdcopy-binary", - Value: "/usr/bin/xrdcopy", - Usage: "Location of the xrdcopy binary", - EnvVars: []string{"REVA_STORAGE_EOS_XRDCOPY_BINARY"}, - Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary, - }, - &cli.StringFlag{ - Name: "storage-eos-master-url", - Value: "root://eos-example.org", - Usage: "URL of the Master EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_MASTER_URL"}, - Destination: &cfg.Reva.Storages.EOS.MasterURL, - }, - &cli.StringFlag{ - Name: "storage-eos-slave-url", - Value: "root://eos-example.org", - Usage: "URL of the Slave EOS MGM", - EnvVars: []string{"REVA_STORAGE_EOS_SLAVE_URL"}, - Destination: &cfg.Reva.Storages.EOS.SlaveURL, - }, - &cli.StringFlag{ - Name: "storage-eos-cache-directory", - Value: os.TempDir(), - Usage: "Location on the local fs where to store reads", - EnvVars: []string{"REVA_STORAGE_EOS_CACHE_DIRECTORY"}, - Destination: &cfg.Reva.Storages.EOS.CacheDirectory, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-logging", - Usage: "Enables logging of the commands executed", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_LOGGING"}, - Destination: &cfg.Reva.Storages.EOS.EnableLogging, - }, - &cli.BoolFlag{ - Name: "storage-eos-show-hidden-sysfiles", - Usage: "show internal EOS files like .sys.v# and .sys.a# files.", - EnvVars: []string{"REVA_STORAGE_EOS_SHOW_HIDDEN_SYSFILES"}, - Destination: &cfg.Reva.Storages.EOS.ShowHiddenSysFiles, - }, - &cli.BoolFlag{ - Name: "storage-eos-force-singleuser-mode", - Usage: "force connections to EOS to use SingleUsername", - EnvVars: []string{"REVA_STORAGE_EOS_FORCE_SINGLEUSER_MODE"}, - Destination: &cfg.Reva.Storages.EOS.ForceSingleUserMode, - }, - &cli.BoolFlag{ - Name: "storage-eos-use-keytab", - Usage: "authenticate requests by using an EOS keytab", - EnvVars: []string{"REVA_STORAGE_EOS_USE_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.UseKeytab, - }, - &cli.BoolFlag{ - Name: "storage-eos-enable-home", - Usage: "enable the creation of home directories", - EnvVars: []string{"REVA_STORAGE_EOS_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.EOS.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-eos-sec-protocol", - Value: "", - Usage: "the xrootd security protocol to use between the server and EOS", - EnvVars: []string{"REVA_STORAGE_EOS_SEC_PROTOCOL"}, - Destination: &cfg.Reva.Storages.EOS.SecProtocol, - }, - &cli.StringFlag{ - Name: "storage-eos-keytab", - Value: "", - Usage: "the location of the keytab to use to authenticate to EOS", - EnvVars: []string{"REVA_STORAGE_EOS_KEYTAB"}, - Destination: &cfg.Reva.Storages.EOS.Keytab, - }, - &cli.StringFlag{ - Name: "storage-eos-single-username", - Value: "", - Usage: "the username to use when SingleUserMode is enabled", - EnvVars: []string{"REVA_STORAGE_EOS_SINGLE_USERNAME"}, - Destination: &cfg.Reva.Storages.EOS.SingleUsername, - }, - &cli.StringFlag{ - Name: "storage-eos-layout", - Value: "{{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{"REVA_STORAGE_EOS_LAYOUT"}, - Destination: &cfg.Reva.Storages.EOS.Layout, - }, - - // local - - &cli.StringFlag{ - Name: "storage-local-root", - Value: "/var/tmp/reva/root", - Usage: "the path to the local storage root", - EnvVars: []string{"REVA_STORAGE_LOCAL_ROOT"}, - Destination: &cfg.Reva.Storages.Local.Root, - }, - - // owncloud - - &cli.StringFlag{ - Name: "storage-owncloud-datadir", - Value: "/var/tmp/reva/data", - Usage: "the path to the owncloud data directory", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_DATADIR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Datadirectory, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-scan", - Value: true, - Usage: "scan files on startup to add fileids", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SCAN"}, - Destination: &cfg.Reva.Storages.OwnCloud.Scan, - }, - &cli.StringFlag{ - Name: "storage-owncloud-redis", - Value: ":6379", - Usage: "the address of the redis server", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_REDIS_ADDR"}, - Destination: &cfg.Reva.Storages.OwnCloud.Redis, - }, - &cli.BoolFlag{ - Name: "storage-owncloud-enable-home", - Value: false, - Usage: "enable the creation of home storages", - EnvVars: []string{"REVA_STORAGE_OWNCLOUD_ENABLE_HOME"}, - Destination: &cfg.Reva.Storages.OwnCloud.EnableHome, - }, - &cli.StringFlag{ - Name: "storage-owncloud-layout", - Value: "{{.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{"REVA_STORAGE_OWNCLOUD_LAYOUT"}, - Destination: &cfg.Reva.Storages.OwnCloud.Layout, - }, - } + return flags }