Merge pull request #461 from butonic/config-cleanup

Config refactor, add ocis storage, fix oc storage sharing
This commit is contained in:
Vincent Petry
2020-09-10 10:56:48 +02:00
committed by GitHub
39 changed files with 1321 additions and 4118 deletions

View File

@@ -1,7 +1,7 @@
config = {
'apiTests': {
'coreBranch': 'master',
'coreCommit': '1f5506549cbebdc910b6d24681278e9a210f6d82',
'coreCommit': 'dd8d46129616602f02a0740bb5cf83bd6b28aa19',
'numberOfParts': 2
}
}

View File

@@ -0,0 +1,8 @@
Bugfix: Fix default configuration for accessing shares
The storage provider mounted at `/home` should always have EnableHome set to `true`. The other storage providers should have it set to `false`.
https://github.com/owncloud/product/issues/205
https://github.com/owncloud/ocis-reva/pull/461

View File

@@ -0,0 +1,8 @@
Enhancement: Allow configuring arbitrary storage registry rules
We added a new config flag `storage-registry-rule` that can be given multiple times for the gateway to specify arbitrary storage registry rules. You can also use a comma separated list of rules in the `REVA_STORAGE_REGISTRY_RULES` environment variable.
https://github.com/owncloud/product/issues/193
https://github.com/owncloud/ocis-reva/pull/461

View File

@@ -8,3 +8,38 @@ geekdocFilePath: _index.md
---
This service provides an ocis extension that wraps [reva](https://github.com/cs3org/reva/) and adds an opinionated configuration to it.
It uses the port range 9140-9179 to preconfigure several services.
| port | service |
+------+---------+
| 9109 | health? |
| 9140 | frontend |
| 9141 | frontend debug |
| 9142 | gateway |
| 9143 | gateway debug |
| 9144 | users |
| 9145 | users debug |
| 9146 | authbasic |
| 9147 | authbasic debug |
| 9148 | authbearer |
| 9149 | authbearer debug |
| 9150 | sharing |
| 9151 | sharing debug |
| 9152 | storage root |
| 9153 | storage root debug |
| 9154 | storage home |
| 9155 | storage home debug |
| 9156 | storage home data |
| 9157 | storage home data debug |
| 9158 | storage eos |
| 9159 | storage eos debug |
| 9160 | storage eos data |
| 9161 | storage eos data debug |
| 9162 | storage oc |
| 9163 | storage oc debug |
| 9164 | storage oc data |
| 9165 | storage oc data debug |
| 9166-9177 | reserved for s3, wnd, custom + data providers |
| 9178 | storage public link |
| 9179 | storage public link data |

View File

File diff suppressed because it is too large Load Diff

102
pkg/command/drivers.go Normal file
View File

@@ -0,0 +1,102 @@
package command
import (
"github.com/owncloud/ocis-reva/pkg/config"
)
func drivers(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Root,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.Storages.EOS.UploadsNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Root,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.Storages.EOS.UploadsNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.UserLayout,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eosgrpc": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Root,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"master_grpc_uri": cfg.Reva.Storages.EOS.GrpcURI,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.UserLayout,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"enable_home": cfg.Reva.Storages.EOS.EnableHome,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"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.Root,
"upload_info_dir": cfg.Reva.Storages.OwnCloud.UploadInfoDir,
"sharedirectory": cfg.Reva.Storages.OwnCloud.ShareFolder,
"user_layout": cfg.Reva.Storages.OwnCloud.UserLayout,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": cfg.Reva.Storages.OwnCloud.EnableHome,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"userprovidersvc": cfg.Reva.Users.URL,
},
"ocis": map[string]interface{}{
"root": cfg.Reva.Storages.Common.Root,
"enable_home": cfg.Reva.Storages.Common.EnableHome,
"user_layout": cfg.Reva.Storages.Common.UserLayout,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
"access_key": cfg.Reva.Storages.S3.AccessKey,
"secret_key": cfg.Reva.Storages.S3.SecretKey,
"endpoint": cfg.Reva.Storages.S3.Endpoint,
"bucket": cfg.Reva.Storages.S3.Bucket,
"prefix": cfg.Reva.Storages.S3.Root,
},
}
}

View File

@@ -5,6 +5,7 @@ import (
"os"
"os/signal"
"path"
"strings"
"time"
"github.com/cs3org/reva/cmd/revad/runtime"
@@ -25,6 +26,7 @@ func Gateway(cfg *config.Config) *cli.Command {
Flags: flagset.GatewayWithConfig(cfg),
Before: func(c *cli.Context) error {
cfg.Reva.Gateway.Services = c.StringSlice("service")
cfg.Reva.StorageRegistry.Rules = c.StringSlice("storage-registry-rule")
return nil
},
@@ -104,8 +106,6 @@ func Gateway(cfg *config.Config) *cli.Command {
"commit_share_to_storage_grant": cfg.Reva.Gateway.CommitShareToStorageGrant,
"commit_share_to_storage_ref": cfg.Reva.Gateway.CommitShareToStorageRef,
"share_folder": cfg.Reva.Gateway.ShareFolder, // ShareFolder is the location where to create shares in the recipient's storage provider.
// public links
"link_grants_file": cfg.Reva.Gateway.LinkGrants,
// other
"disable_home_creation_on_login": cfg.Reva.Gateway.DisableHomeCreationOnLogin,
"datagateway": urlWithScheme(cfg.Reva.DataGateway.URL),
@@ -125,28 +125,11 @@ func Gateway(cfg *config.Config) *cli.Command {
},
},
"storageregistry": map[string]interface{}{
"driver": "static",
"driver": cfg.Reva.StorageRegistry.Driver,
"drivers": map[string]interface{}{
"static": map[string]interface{}{
"home_provider": cfg.Reva.Gateway.HomeProvider,
"rules": map[string]interface{}{
cfg.Reva.StorageRoot.MountPath: cfg.Reva.StorageRoot.URL,
cfg.Reva.StorageRoot.MountID: cfg.Reva.StorageRoot.URL,
cfg.Reva.StorageHome.MountPath: cfg.Reva.StorageHome.URL,
cfg.Reva.StorageHome.MountID: cfg.Reva.StorageHome.URL,
cfg.Reva.StorageEOS.MountPath: cfg.Reva.StorageEOS.URL,
cfg.Reva.StorageEOS.MountID: cfg.Reva.StorageEOS.URL,
cfg.Reva.StorageOC.MountPath: cfg.Reva.StorageOC.URL,
cfg.Reva.StorageOC.MountID: cfg.Reva.StorageOC.URL,
cfg.Reva.StorageS3.MountPath: cfg.Reva.StorageS3.URL,
cfg.Reva.StorageS3.MountID: cfg.Reva.StorageS3.URL,
cfg.Reva.StorageWND.MountPath: cfg.Reva.StorageWND.URL,
cfg.Reva.StorageWND.MountID: cfg.Reva.StorageWND.URL,
cfg.Reva.StorageCustom.MountPath: cfg.Reva.StorageCustom.URL,
cfg.Reva.StorageCustom.MountID: cfg.Reva.StorageCustom.URL,
"/public/": "localhost:10054",
"e1a73ede-549b-4226-abdf-40e69ca8230d": "localhost:10054",
},
"home_provider": cfg.Reva.StorageRegistry.HomeProvider,
"rules": rules(cfg),
},
},
},
@@ -241,3 +224,36 @@ func Gateway(cfg *config.Config) *cli.Command {
},
}
}
func rules(cfg *config.Config) map[string]interface{} {
// if a list of rules is given it overrides the generated rules from below
if len(cfg.Reva.StorageRegistry.Rules) > 0 {
rules := map[string]interface{}{}
for i := range cfg.Reva.StorageRegistry.Rules {
parts := strings.SplitN(cfg.Reva.StorageRegistry.Rules[i], "=", 2)
rules[parts[0]] = parts[1]
}
return rules
}
// generate rules based on default config
return map[string]interface{}{
cfg.Reva.StorageRoot.MountPath: cfg.Reva.StorageRoot.URL,
cfg.Reva.StorageRoot.MountID: cfg.Reva.StorageRoot.URL,
cfg.Reva.StorageHome.MountPath: cfg.Reva.StorageHome.URL,
cfg.Reva.StorageHome.MountID: cfg.Reva.StorageHome.URL,
cfg.Reva.StorageEOS.MountPath: cfg.Reva.StorageEOS.URL,
cfg.Reva.StorageEOS.MountID: cfg.Reva.StorageEOS.URL,
cfg.Reva.StorageOC.MountPath: cfg.Reva.StorageOC.URL,
cfg.Reva.StorageOC.MountID: cfg.Reva.StorageOC.URL,
cfg.Reva.StorageS3.MountPath: cfg.Reva.StorageS3.URL,
cfg.Reva.StorageS3.MountID: cfg.Reva.StorageS3.URL,
cfg.Reva.StorageWND.MountPath: cfg.Reva.StorageWND.URL,
cfg.Reva.StorageWND.MountID: cfg.Reva.StorageWND.URL,
cfg.Reva.StorageCustom.MountPath: cfg.Reva.StorageCustom.URL,
cfg.Reva.StorageCustom.MountID: cfg.Reva.StorageCustom.URL,
cfg.Reva.StoragePublicLink.MountPath: cfg.Reva.StoragePublicLink.URL,
// public link storage returns the mount id of the actual storage
}
}

View File

@@ -87,52 +87,13 @@ func StorageEOS(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageEOS.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
},
"driver": cfg.Reva.StorageEOS.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageEOS.MountPath,
"mount_id": cfg.Reva.StorageEOS.MountID,
"expose_data_server": cfg.Reva.StorageEOS.ExposeDataServer,
// TODO use cfg.Reva.SStorageEOSData.URL, ?
"data_server_url": cfg.Reva.StorageEOS.DataServerURL,
"enable_home_creation": cfg.Reva.StorageEOS.EnableHomeCreation,
"data_server_url": cfg.Reva.StorageEOS.DataServerURL,
},
},
},

View File

@@ -88,47 +88,9 @@ func StorageEOSData(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageEOSData.Prefix,
"driver": cfg.Reva.StorageEOSData.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
},
"prefix": cfg.Reva.StorageEOSData.Prefix,
"driver": cfg.Reva.StorageEOSData.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,

View File

@@ -70,6 +70,14 @@ func StorageHome(cfg *config.Config) *cli.Command {
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
// override driver enable home option with home config
if cfg.Reva.Storages.Home.EnableHome {
cfg.Reva.Storages.Common.EnableHome = true
cfg.Reva.Storages.EOS.EnableHome = true
cfg.Reva.Storages.Local.EnableHome = true
cfg.Reva.Storages.OwnCloud.EnableHome = true
cfg.Reva.Storages.S3.EnableHome = true
}
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
@@ -87,71 +95,13 @@ func StorageHome(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageHome.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.Storages.Local.Root,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.Storages.OwnCloud.Datadirectory,
"scan": cfg.Reva.Storages.OwnCloud.Scan,
"redis": cfg.Reva.Storages.OwnCloud.Redis,
"enable_home": true,
"user_layout": cfg.Reva.Storages.OwnCloud.Layout,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
"access_key": cfg.Reva.Storages.S3.AccessKey,
"secret_key": cfg.Reva.Storages.S3.SecretKey,
"endpoint": cfg.Reva.Storages.S3.Endpoint,
"bucket": cfg.Reva.Storages.S3.Bucket,
"prefix": cfg.Reva.Storages.S3.Prefix,
},
},
"driver": cfg.Reva.StorageHome.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageHome.MountPath,
"mount_id": cfg.Reva.StorageHome.MountID,
"expose_data_server": cfg.Reva.StorageHome.ExposeDataServer,
// TODO use cfg.Reva.StorageHomeData.URL, ?
"data_server_url": cfg.Reva.StorageHome.DataServerURL,
"enable_home_creation": cfg.Reva.StorageHome.EnableHomeCreation,
"data_server_url": cfg.Reva.StorageHome.DataServerURL,
},
},
},

View File

@@ -70,6 +70,14 @@ func StorageHomeData(cfg *config.Config) *cli.Command {
uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")
// override driver enable home option with home config
if cfg.Reva.Storages.Home.EnableHome {
cfg.Reva.Storages.Common.EnableHome = true
cfg.Reva.Storages.EOS.EnableHome = true
cfg.Reva.Storages.Local.EnableHome = true
cfg.Reva.Storages.OwnCloud.EnableHome = true
cfg.Reva.Storages.S3.EnableHome = true
}
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.Users.MaxCPUs,
@@ -88,66 +96,9 @@ func StorageHomeData(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageHomeData.Prefix,
"driver": cfg.Reva.StorageHomeData.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.Storages.Local.Root,
},
"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,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
"access_key": cfg.Reva.Storages.S3.AccessKey,
"secret_key": cfg.Reva.Storages.S3.SecretKey,
"endpoint": cfg.Reva.Storages.S3.Endpoint,
"bucket": cfg.Reva.Storages.S3.Bucket,
"prefix": cfg.Reva.Storages.S3.Prefix,
},
},
"prefix": cfg.Reva.StorageHomeData.Prefix,
"driver": cfg.Reva.StorageHomeData.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,

View File

@@ -87,71 +87,13 @@ func StorageOC(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageOC.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.Storages.Local.Root,
},
"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,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
"access_key": cfg.Reva.Storages.S3.AccessKey,
"secret_key": cfg.Reva.Storages.S3.SecretKey,
"endpoint": cfg.Reva.Storages.S3.Endpoint,
"bucket": cfg.Reva.Storages.S3.Bucket,
"prefix": cfg.Reva.Storages.S3.Prefix,
},
},
"driver": cfg.Reva.StorageOC.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageOC.MountPath,
"mount_id": cfg.Reva.StorageOC.MountID,
"expose_data_server": cfg.Reva.StorageOC.ExposeDataServer,
// TODO use cfg.Reva.SStorageOCData.URL, ?
"data_server_url": cfg.Reva.StorageOC.DataServerURL,
"enable_home_creation": cfg.Reva.StorageOC.EnableHomeCreation,
"data_server_url": cfg.Reva.StorageOC.DataServerURL,
},
},
},

View File

@@ -88,66 +88,9 @@ func StorageOCData(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageOCData.Prefix,
"driver": cfg.Reva.StorageOCData.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.Storages.Local.Root,
},
"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,
"userprovidersvc": cfg.Reva.Users.URL,
},
"s3": map[string]interface{}{
"region": cfg.Reva.Storages.S3.Region,
"access_key": cfg.Reva.Storages.S3.AccessKey,
"secret_key": cfg.Reva.Storages.S3.SecretKey,
"endpoint": cfg.Reva.Storages.S3.Endpoint,
"bucket": cfg.Reva.Storages.S3.Bucket,
"prefix": cfg.Reva.Storages.S3.Prefix,
},
},
"prefix": cfg.Reva.StorageOCData.Prefix,
"driver": cfg.Reva.StorageOCData.Driver,
"drivers": drivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,

View File

@@ -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-link",
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
@@ -83,8 +86,6 @@ func StoragePublicLink(cfg *config.Config) *cli.Command {
"services": map[string]interface{}{
"publicstorageprovider": map[string]interface{}{
"mount_path": cfg.Reva.StoragePublicLink.MountPath,
"mount_id": cfg.Reva.StoragePublicLink.MountID,
"driver_addr": cfg.Reva.StoragePublicLink.PublicShareProviderAddr,
"gateway_addr": cfg.Reva.Gateway.URL,
},
"authprovider": map[string]interface{}{

View File

@@ -87,69 +87,12 @@ func StorageRoot(cfg *config.Config) *cli.Command {
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageRoot.Driver,
"drivers": map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.Storages.EOS.Namespace,
"shadow_namespace": cfg.Reva.Storages.EOS.ShadowNamespace,
"share_folder": cfg.Reva.Storages.EOS.ShareFolder,
"eos_binary": cfg.Reva.Storages.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.Storages.EOS.XrdcopyBinary,
"master_url": cfg.Reva.Storages.EOS.MasterURL,
"slave_url": cfg.Reva.Storages.EOS.SlaveURL,
"cache_directory": cfg.Reva.Storages.EOS.CacheDirectory,
"enable_logging": cfg.Reva.Storages.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.Storages.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.Storages.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.Storages.EOS.UseKeytab,
"sec_protocol": cfg.Reva.Storages.EOS.SecProtocol,
"keytab": cfg.Reva.Storages.EOS.Keytab,
"single_username": cfg.Reva.Storages.EOS.SingleUsername,
"user_layout": cfg.Reva.Storages.EOS.Layout,
"gatewaysvc": cfg.Reva.Storages.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.Storages.Local.Root,
},
"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{}{
"region": cfg.Reva.Storages.S3.Region,
"access_key": cfg.Reva.Storages.S3.AccessKey,
"secret_key": cfg.Reva.Storages.S3.SecretKey,
"endpoint": cfg.Reva.Storages.S3.Endpoint,
"bucket": cfg.Reva.Storages.S3.Bucket,
"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,
"driver": cfg.Reva.StorageRoot.Driver,
"drivers": drivers(cfg),
"mount_path": cfg.Reva.StorageRoot.MountPath,
"mount_id": cfg.Reva.StorageRoot.MountID,
"expose_data_server": cfg.Reva.StorageRoot.ExposeDataServer,
"data_server_url": cfg.Reva.StorageRoot.DataServerURL,
},
},
},

View File

@@ -23,9 +23,14 @@ type Gateway struct {
ShareFolder string
LinkGrants string
DisableHomeCreationOnLogin bool
// include the home folder config for the storage registry
}
// StorageRegistry defines the available storage registry configuration
type StorageRegistry struct {
Driver string
// HomeProvider is the path in the global namespace that the static storage registry uses to determine the home storage
HomeProvider string
Rules []string
}
// Sharing defines the available sharing configuration.
@@ -77,12 +82,11 @@ type FrontendPort 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
@@ -94,31 +98,42 @@ type PublicStorage struct {
StoragePort
PublicShareProviderAddr string
StorageProviderAddr string
UserProviderAddr string
MountID string
}
// StorageConfig combines all available storage driver configuration parts.
type StorageConfig struct {
Home DriverCommon
EOS DriverEOS
Local DriverLocal
Local DriverCommon
OwnCloud DriverOwnCloud
S3 DriverS3
Common DriverCommon
// TODO checksums ... figure out what that is supposed to do
}
// DriverCommon defines common driver configuration options.
type DriverCommon struct {
// Root is the absolute path to the location of the data
Root string
//ShareFolder defines the name of the folder jailing all shares
ShareFolder string
// UserLayout contains the template used to construct
// the internal path, eg: `{{substr 0 1 .Username}}/{{.Username}}`
UserLayout string
// EnableHome enables the creation of home directories.
EnableHome bool
}
// DriverEOS defines the available EOS driver configuration.
type DriverEOS struct {
// Namespace for metadata operations
Namespace string
DriverCommon
// ShadowNamespace for storing shadow data
ShadowNamespace string
// ShareFolder defines the name of the folder in the
// shadowed namespace. Ex: /eos/user/.shadow/h/hugo/MyShares
ShareFolder string
// UploadsNamespace for storing upload data
UploadsNamespace string
// Location of the eos binary.
// Default is /usr/bin/eos.
@@ -132,6 +147,10 @@ type DriverEOS struct {
// Default is root://eos-example.org
MasterURL string
// URI of the EOS MGM grpc server
// Default is empty
GrpcURI string
// URL of the Slave EOS MGM.
// Default is root://eos-example.org
SlaveURL string
@@ -154,9 +173,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
@@ -166,35 +182,28 @@ type DriverEOS struct {
// SingleUsername is the username to use when SingleUserMode is enabled
SingleUsername string
// Layout of the users home dir path
Layout string
// gateway service to use for uid lookups
GatewaySVC string
}
// DriverLocal defines the available local storage driver configuration.
type DriverLocal struct {
Root string
}
// DriverOwnCloud defines the available ownCloud storage driver configuration.
type DriverOwnCloud struct {
Datadirectory string
Layout string
DriverCommon
UploadInfoDir string
Redis string
Scan bool
EnableHome bool
}
// DriverS3 defines the available S3 storage driver configuration.
type DriverS3 struct {
DriverCommon
Region string
AccessKey string
SecretKey string
Endpoint string
Bucket string
Prefix string
}
// OIDC defines the available OpenID Connect configuration.
@@ -267,12 +276,14 @@ type Reva struct {
Frontend FrontendPort
DataGateway Port
Gateway Gateway
StorageRegistry StorageRegistry
Users Users
AuthProvider Users
AuthBasic Port
AuthBearer Port
Sharing Sharing
StorageRoot StoragePort
StorageRootData StoragePort
StorageHome StoragePort
StorageHomeData StoragePort
StorageEOS StoragePort

View File

@@ -7,42 +7,7 @@ import (
// AuthBasicWithConfig applies cfg to the root flagset
func AuthBasicWithConfig(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,
},
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -52,35 +17,6 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_AUTH_BASIC_DEBUG_ADDR"},
Destination: &cfg.Reva.AuthBasic.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,
},
// REVA
&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,
},
// Auth
@@ -99,87 +35,6 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.AuthProvider.JSON,
},
// LDAP
&cli.StringFlag{
Name: "ldap-hostname",
Value: "localhost",
Usage: "LDAP hostname",
EnvVars: []string{"REVA_LDAP_HOSTNAME"},
Destination: &cfg.Reva.LDAP.Hostname,
},
&cli.IntFlag{
Name: "ldap-port",
Value: 9126,
Usage: "LDAP port",
EnvVars: []string{"REVA_LDAP_PORT"},
Destination: &cfg.Reva.LDAP.Port,
},
&cli.StringFlag{
Name: "ldap-base-dn",
Value: "dc=example,dc=org",
Usage: "LDAP basedn",
EnvVars: []string{"REVA_LDAP_BASE_DN"},
Destination: &cfg.Reva.LDAP.BaseDN,
},
&cli.StringFlag{
Name: "ldap-loginfilter",
Value: "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))",
Usage: "LDAP login filter",
EnvVars: []string{"REVA_LDAP_LOGINFILTER"},
Destination: &cfg.Reva.LDAP.LoginFilter,
},
&cli.StringFlag{
Name: "ldap-bind-dn",
Value: "cn=reva,ou=sysusers,dc=example,dc=org",
Usage: "LDAP bind dn",
EnvVars: []string{"REVA_LDAP_BIND_DN"},
Destination: &cfg.Reva.LDAP.BindDN,
},
&cli.StringFlag{
Name: "ldap-bind-password",
Value: "reva",
Usage: "LDAP bind password",
EnvVars: []string{"REVA_LDAP_BIND_PASSWORD"},
Destination: &cfg.Reva.LDAP.BindPassword,
},
&cli.StringFlag{
Name: "ldap-idp",
Value: "https://localhost:9200",
Usage: "Identity provider to use for users",
EnvVars: []string{"REVA_LDAP_IDP"},
Destination: &cfg.Reva.LDAP.IDP,
},
// ldap dn is always the dn
&cli.StringFlag{
Name: "ldap-schema-uid",
Value: "ownclouduuid",
Usage: "LDAP schema uid",
EnvVars: []string{"REVA_LDAP_SCHEMA_UID"},
Destination: &cfg.Reva.LDAP.Schema.UID,
},
&cli.StringFlag{
Name: "ldap-schema-mail",
Value: "mail",
Usage: "LDAP schema mail",
EnvVars: []string{"REVA_LDAP_SCHEMA_MAIL"},
Destination: &cfg.Reva.LDAP.Schema.Mail,
},
&cli.StringFlag{
Name: "ldap-schema-displayName",
Value: "displayname",
Usage: "LDAP schema displayName",
EnvVars: []string{"REVA_LDAP_SCHEMA_DISPLAYNAME"},
Destination: &cfg.Reva.LDAP.Schema.DisplayName,
},
&cli.StringFlag{
Name: "ldap-schema-cn",
Value: "cn",
Usage: "LDAP schema cn",
EnvVars: []string{"REVA_LDAP_SCHEMA_CN"},
Destination: &cfg.Reva.LDAP.Schema.CN,
},
// Services
// AuthBasic
@@ -219,4 +74,11 @@ func AuthBasicWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_AUTH_BASIC_SERVICES"},
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, LDAPWithConfig(cfg)...)
return flags
}

View File

@@ -7,42 +7,7 @@ import (
// AuthBearerWithConfig applies cfg to the root flagset
func AuthBearerWithConfig(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,
},
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -52,35 +17,6 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_AUTH_BEARER_DEBUG_ADDR"},
Destination: &cfg.Reva.AuthBearer.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,
},
// REVA
&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,
},
// OIDC
@@ -165,4 +101,10 @@ func AuthBearerWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_AUTH_BEARER_SERVICES"},
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

31
pkg/flagset/debug.go Normal file
View File

@@ -0,0 +1,31 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// DebugWithConfig applies common debug config cfg to the flagset
func DebugWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-token",
Value: "",
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,
},
}
}

133
pkg/flagset/drivereos.go Normal file
View File

@@ -0,0 +1,133 @@
package flagset
import (
"os"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// DriverEOSWithConfig applies cfg to the root flagset
func DriverEOSWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&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.Root,
},
&cli.StringFlag{
Name: "storage-eos-shadow-namespace",
// Defaults to path.Join(c.Namespace, ".shadow")
Usage: "Shadow namespace where share references are stored",
EnvVars: []string{"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.UserLayout,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
}
}

View File

@@ -0,0 +1,19 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// DriverLocalWithConfig applies cfg to the root flagset
func DriverLocalWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&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,
},
}
}

33
pkg/flagset/driverocis.go Normal file
View File

@@ -0,0 +1,33 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// DriverOCISWithConfig applies cfg to the root flagset
func DriverOCISWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-ocis-root",
Value: "/var/tmp/ocis/root",
Usage: "the path to the local storage root",
EnvVars: []string{"REVA_STORAGE_OCIS_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
},
&cli.BoolFlag{
Name: "storage-ocis-enable-home",
Value: false,
Usage: "enable the creation of home storages",
EnvVars: []string{"REVA_STORAGE_OCIS_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Common.EnableHome,
},
&cli.StringFlag{
Name: "storage-ocis-layout",
Value: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OCIS_LAYOUT"},
Destination: &cfg.Reva.Storages.Common.UserLayout,
},
}
}

View File

@@ -0,0 +1,61 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// DriverOwnCloudWithConfig applies cfg to the root flagset
func DriverOwnCloudWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&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.Root,
},
&cli.StringFlag{
Name: "storage-owncloud-uploadinfo-dir",
Value: "/var/tmp/reva/uploadinfo",
Usage: "the path to the tus upload info directory",
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_UPLOADINFO_DIR"},
Destination: &cfg.Reva.Storages.OwnCloud.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloud-share-folder",
Value: "/Shares",
Usage: "name of the shares folder",
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_SHARE_FOLDER"},
Destination: &cfg.Reva.Storages.OwnCloud.ShareFolder,
},
&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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.UserLayout,
},
}
}

View File

@@ -7,42 +7,7 @@ import (
// FrontendWithConfig applies cfg to the root flagset
func FrontendWithConfig(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,
},
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -52,35 +17,9 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_FRONTEND_DEBUG_ADDR"},
Destination: &cfg.Reva.Frontend.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,
},
// REVA
&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,
},
&cli.StringFlag{
Name: "transfer-secret",
Value: "replace-me-with-a-transfer-secret",
@@ -202,4 +141,10 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.UploadHTTPMethodOverride,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -7,42 +7,7 @@ import (
// GatewayWithConfig applies cfg to the root flagset
func GatewayWithConfig(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,
},
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -52,35 +17,9 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_GATEWAY_DEBUG_ADDR"},
Destination: &cfg.Reva.Gateway.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,
},
// REVA
&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,
},
&cli.StringFlag{
Name: "transfer-secret",
Value: "replace-me-with-a-transfer-secret",
@@ -159,14 +98,6 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_GATEWAY_SHARE_FOLDER"},
Destination: &cfg.Reva.Gateway.ShareFolder,
},
// TODO(refs) temporary workaround needed for storing link grants.
&cli.StringFlag{
Name: "link_grants_file",
Value: "/var/tmp/reva/link_grants.json",
Usage: "when using a json manager, file to use as json serialized database",
EnvVars: []string{"REVA_GATEWAY_LINK_GRANTS_FILE"},
Destination: &cfg.Reva.Gateway.LinkGrants,
},
&cli.BoolFlag{
Name: "disable-home-creation-on-login",
Usage: "Disable creation of home folder on login",
@@ -178,12 +109,26 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
// storage registry
&cli.StringFlag{
Name: "storage-registry-driver",
Value: "static",
Usage: "driver of the storage registry",
EnvVars: []string{"REVA_STORAGE_REGISTRY_DRIVER"},
Destination: &cfg.Reva.StorageRegistry.Driver,
},
&cli.StringSliceFlag{
Name: "storage-registry-rule",
Value: cli.NewStringSlice(),
Usage: `Replaces the generated storage registry rules with this set: --storage-registry-rule "/eos=localhost:9158" [--storage-registry-rule "1284d238-aa92-42ce-bdc4-0b0000009162=localhost:9162"]`,
EnvVars: []string{"REVA_STORAGE_REGISTRY_RULES"},
},
&cli.StringFlag{
Name: "storage-home-provider",
Value: "/home",
Usage: "mount point of the storage provider for user homes in the global namespace",
EnvVars: []string{"REVA_STORAGE_HOME_PROVIDER"},
Destination: &cfg.Reva.Gateway.HomeProvider,
Destination: &cfg.Reva.StorageRegistry.HomeProvider,
},
&cli.StringFlag{
@@ -266,11 +211,8 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.StorageHome.MountPath,
},
&cli.StringFlag{
Name: "storage-home-mount-id",
// This is tho mount id of the /oc storage
// set it to 1284d238-aa92-42ce-bdc4-0b0000009158 for /eos
// Value: "1284d238-aa92-42ce-bdc4-0b0000009162", /os
Value: "1284d238-aa92-42ce-bdc4-0b0000009154", // /home
Name: "storage-home-mount-id",
Value: "1284d238-aa92-42ce-bdc4-0b0000009154",
Usage: "mount id",
EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_ID"},
Destination: &cfg.Reva.StorageHome.MountID,
@@ -319,12 +261,27 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_STORAGE_OC_MOUNT_ID"},
Destination: &cfg.Reva.StorageOC.MountID,
},
&cli.StringFlag{
Name: "public-links-url",
Value: "localhost:10054",
Name: "public-link-url",
Value: "localhost:9178",
Usage: "URL to use for the public links service",
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_URL"},
Destination: &cfg.Reva.StoragePublicLink.URL,
},
&cli.StringFlag{
Name: "storage-public-link-mount-path",
Value: "/public/",
Usage: "mount path",
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
},
// public-link has no mount id
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

134
pkg/flagset/ldap.go Normal file
View File

@@ -0,0 +1,134 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// LDAPWithConfig applies LDAP cfg to the flagset
func LDAPWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "ldap-hostname",
Value: "localhost",
Usage: "LDAP hostname",
EnvVars: []string{"REVA_LDAP_HOSTNAME"},
Destination: &cfg.Reva.LDAP.Hostname,
},
&cli.IntFlag{
Name: "ldap-port",
Value: 9126,
Usage: "LDAP port",
EnvVars: []string{"REVA_LDAP_PORT"},
Destination: &cfg.Reva.LDAP.Port,
},
&cli.StringFlag{
Name: "ldap-base-dn",
Value: "dc=example,dc=org",
Usage: "LDAP basedn",
EnvVars: []string{"REVA_LDAP_BASE_DN"},
Destination: &cfg.Reva.LDAP.BaseDN,
},
&cli.StringFlag{
Name: "ldap-loginfilter",
Value: "(&(objectclass=posixAccount)(|(cn={{login}})(mail={{login}})))",
Usage: "LDAP login filter",
EnvVars: []string{"REVA_LDAP_LOGINFILTER"},
Destination: &cfg.Reva.LDAP.LoginFilter,
},
&cli.StringFlag{
Name: "ldap-userfilter",
Value: "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
Usage: "LDAP filter used when getting a user. The CS3 userid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"REVA_LDAP_USERFILTER"},
Destination: &cfg.Reva.LDAP.UserFilter,
},
&cli.StringFlag{
Name: "ldap-attributefilter",
Value: "(&(objectclass=posixAccount)({{attr}}={{value}}))",
Usage: "LDAP filter used when searching for a user by claim/attribute. {{attr}} will be replaced with the attribute, {{value}} with the value.",
EnvVars: []string{"REVA_LDAP_ATTRIBUTEFILTER"},
Destination: &cfg.Reva.LDAP.AttributeFilter,
},
&cli.StringFlag{
Name: "ldap-findfilter",
Value: "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
Usage: "LDAP filter used when searching for recipients. {{query}} will be replaced with the search query",
EnvVars: []string{"REVA_LDAP_FINDFILTER"},
Destination: &cfg.Reva.LDAP.FindFilter,
},
&cli.StringFlag{
Name: "ldap-groupfilter",
// FIXME the reva implementation needs to use the memberof overlay to get the cn when it only has the uuid,
// because the ldap schema either uses the dn or the member(of) attributes to establish membership
Value: "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))", // This filter will never work
Usage: "LDAP filter used when getting the groups of a user. The CS3 userid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"REVA_LDAP_GROUPFILTER"},
Destination: &cfg.Reva.LDAP.GroupFilter,
},
&cli.StringFlag{
Name: "ldap-bind-dn",
Value: "cn=reva,ou=sysusers,dc=example,dc=org",
Usage: "LDAP bind dn",
EnvVars: []string{"REVA_LDAP_BIND_DN"},
Destination: &cfg.Reva.LDAP.BindDN,
},
&cli.StringFlag{
Name: "ldap-bind-password",
Value: "reva",
Usage: "LDAP bind password",
EnvVars: []string{"REVA_LDAP_BIND_PASSWORD"},
Destination: &cfg.Reva.LDAP.BindPassword,
},
&cli.StringFlag{
Name: "ldap-idp",
Value: "https://localhost:9200",
Usage: "Identity provider to use for users",
EnvVars: []string{"REVA_LDAP_IDP"},
Destination: &cfg.Reva.LDAP.IDP,
},
// ldap dn is always the dn
&cli.StringFlag{
Name: "ldap-schema-uid",
Value: "ownclouduuid",
Usage: "LDAP schema uid",
EnvVars: []string{"REVA_LDAP_SCHEMA_UID"},
Destination: &cfg.Reva.LDAP.Schema.UID,
},
&cli.StringFlag{
Name: "ldap-schema-mail",
Value: "mail",
Usage: "LDAP schema mail",
EnvVars: []string{"REVA_LDAP_SCHEMA_MAIL"},
Destination: &cfg.Reva.LDAP.Schema.Mail,
},
&cli.StringFlag{
Name: "ldap-schema-displayName",
Value: "displayname",
Usage: "LDAP schema displayName",
EnvVars: []string{"REVA_LDAP_SCHEMA_DISPLAYNAME"},
Destination: &cfg.Reva.LDAP.Schema.DisplayName,
},
&cli.StringFlag{
Name: "ldap-schema-cn",
Value: "cn",
Usage: "LDAP schema cn",
EnvVars: []string{"REVA_LDAP_SCHEMA_CN"},
Destination: &cfg.Reva.LDAP.Schema.CN,
},
&cli.StringFlag{
Name: "ldap-schema-uidnumber",
Value: "uidnumber",
Usage: "LDAP schema uidnumber",
EnvVars: []string{"REVA_LDAP_SCHEMA_UID_NUMBER"},
Destination: &cfg.Reva.LDAP.Schema.UIDNumber,
},
&cli.StringFlag{
Name: "ldap-schema-gidnumber",
Value: "gidnumber",
Usage: "LDAP schema gidnumber",
EnvVars: []string{"REVA_LDAP_SCHEMA_GIDNUMBER"},
Destination: &cfg.Reva.LDAP.Schema.GIDNumber,
},
}
}

19
pkg/flagset/secret.go Normal file
View File

@@ -0,0 +1,19 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// SecretWithConfig applies cfg to the root flagset
func SecretWithConfig(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,
},
}
}

View File

@@ -7,42 +7,7 @@ import (
// SharingWithConfig applies cfg to the root flagset
func SharingWithConfig(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,
},
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -52,35 +17,6 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_SHARING_DEBUG_ADDR"},
Destination: &cfg.Reva.Sharing.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,
},
// REVA
&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
@@ -142,4 +78,10 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Sharing.PublicDriver,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,39 +17,8 @@ func StorageEOSWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
// Storage eos
&cli.StringFlag{
Name: "network",
@@ -126,7 +58,7 @@ func StorageEOSWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "eos",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for eos mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_EOS_DRIVER"},
Destination: &cfg.Reva.StorageEOS.Driver,
},
@@ -158,183 +90,15 @@ 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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,35 +17,6 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
@@ -125,7 +59,7 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "eos",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for eos data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_EOS_DATA_DRIVER"},
Destination: &cfg.Reva.StorageEOSData.Driver,
},
@@ -144,177 +78,6 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
// Gateway
&cli.StringFlag{
@@ -324,5 +87,25 @@ func StorageEOSDataWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_GATEWAY_URL"},
Destination: &cfg.Reva.Gateway.URL,
},
// User provider
&cli.StringFlag{
Name: "users-url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,35 +17,6 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
@@ -126,7 +60,7 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for home mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_HOME_DRIVER"},
Destination: &cfg.Reva.StorageHome.Driver,
},
@@ -139,11 +73,11 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "mount-id",
// This is tho mount id of the /oc storage
// set it to 1284d238-aa92-42ce-bdc4-0b0000009158 for /eos
// Value: "1284d238-aa92-42ce-bdc4-0b0000009162", /os
Value: "1284d238-aa92-42ce-bdc4-0b0000009154", // /home
// This is the mount id of the storage provider using the same storage driver
// as /home but withoud home enabled. Set it to
// 1284d238-aa92-42ce-bdc4-0b0000009158 for /eos
// 1284d238-aa92-42ce-bdc4-0b0000009162 for /oc
Value: "1284d238-aa92-42ce-bdc4-0b0000009162", // /oc
Usage: "mount id",
EnvVars: []string{"REVA_STORAGE_HOME_MOUNT_ID"},
Destination: &cfg.Reva.StorageHome.MountID,
@@ -163,183 +97,11 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
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",
Name: "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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
EnvVars: []string{"REVA_STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// User provider
@@ -352,4 +114,14 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,35 +17,6 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
@@ -125,7 +59,7 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for home data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_HOME_DATA_DRIVER"},
Destination: &cfg.Reva.StorageHomeData.Driver,
},
@@ -143,177 +77,12 @@ 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",
Name: "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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
EnvVars: []string{"REVA_STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// Gateway
@@ -336,4 +105,14 @@ func StorageHomeDataWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,35 +17,6 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
@@ -126,7 +60,7 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for oc mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_OC_DRIVER"},
Destination: &cfg.Reva.StorageOC.Driver,
},
@@ -158,187 +92,6 @@ 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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
// User provider
@@ -350,4 +103,14 @@ func StorageOCWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,35 +17,6 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
@@ -125,7 +59,7 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "owncloud",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for oc data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_OC_DATA_DRIVER"},
Destination: &cfg.Reva.StorageOCData.Driver,
},
@@ -144,180 +78,6 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
// Gateway
&cli.StringFlag{
@@ -338,4 +98,14 @@ func StorageOCDataWithConfig(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Users.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

View File

@@ -7,74 +7,16 @@ 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,
},
flags := []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: "0.0.0.0:10053",
Value: "0.0.0.0:9179",
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,
},
&cli.StringFlag{
Name: "network",
Value: "tcp",
@@ -91,74 +33,19 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "addr",
Value: "localhost:10054",
Value: "0.0.0.0:9178",
Usage: "Address to bind reva service",
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.Addr,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("storageprovider"),
Usage: "--service storageprovider [--service otherservice]",
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_SERVICES"},
&cli.StringFlag{
Name: "url",
Value: "localhost:9178",
Usage: "Address to bind reva service",
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_URL"},
Destination: &cfg.Reva.StoragePublicLink.URL,
},
&cli.StringFlag{
Name: "public_share_provider_addr",
Value: "localhost:9150",
Usage: "public share provider service address",
EnvVars: []string{"REVA_STORAGE_PUBLICLINK_PUBLIC_SHARE_PROVIDER_ADDR"},
Destination: &cfg.Reva.StoragePublicLink.PublicShareProviderAddr,
},
&cli.StringFlag{
Name: "user_provider_addr",
Value: "localhost:9144",
Usage: "user provider service address",
EnvVars: []string{"REVA_STORAGE_PUBLICLINK_USER_PROVIDER_ADDR"},
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,
},
&cli.StringFlag{
Name: "mount-id",
Value: "e1a73ede-549b-4226-abdf-40e69ca8230d",
Usage: "mount id",
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_ID"},
Destination: &cfg.Reva.StoragePublicLink.MountID,
},
&cli.BoolFlag{
Name: "expose-data-server",
Value: false,
Usage: "exposes a dedicated data server",
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/",
@@ -166,6 +53,7 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_STORAGE_PUBLIC_LINK_MOUNT_PATH"},
Destination: &cfg.Reva.StoragePublicLink.MountPath,
},
&cli.StringFlag{
Name: "gateway-url",
Value: "localhost:9142",
@@ -174,4 +62,10 @@ func StoragePublicLink(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Gateway.URL,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
return flags
}

View File

@@ -1,50 +1,13 @@
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{
&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 := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -54,35 +17,6 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag {
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,
},
// REVA
&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
@@ -126,7 +60,7 @@ func StorageRootWithConfig(cfg *config.Config) []cli.Flag {
&cli.StringFlag{
Name: "driver",
Value: "local",
Usage: "storage driver, eg. local, eos, owncloud or s3",
Usage: "storage driver for root mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"REVA_STORAGE_ROOT_DRIVER"},
Destination: &cfg.Reva.StorageRoot.Driver,
},
@@ -157,171 +91,15 @@ 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,
},
&cli.StringFlag{
Name: "storage-eos-gatewaysvc",
Value: "localhost:9142",
Usage: "URL to use for the reva gateway service",
EnvVars: []string{"REVA_STORAGE_EOS_GATEWAYSVC"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
// 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: "{{.Id.OpaqueId}}",
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"REVA_STORAGE_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.Layout,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
return flags
}

47
pkg/flagset/tracing.go Normal file
View File

@@ -0,0 +1,47 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-reva/pkg/config"
)
// TracingWithConfig applies cfg to the root flagset
func TracingWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.BoolFlag{
Name: "tracing-enabled",
Usage: "Enable sending traces",
EnvVars: []string{"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,
},
}
}

View File

@@ -7,42 +7,7 @@ import (
// UsersWithConfig applies cfg to the root flagset
func UsersWithConfig(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,
},
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
@@ -52,153 +17,63 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_SHARING_DEBUG_ADDR"},
Destination: &cfg.Reva.Users.DebugAddr,
},
// Services
// Users
&cli.StringFlag{
Name: "debug-token",
Name: "network",
Value: "tcp",
Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"REVA_USERS_NETWORK"},
Destination: &cfg.Reva.Users.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for reva service, can be 'http' or 'grpc'",
EnvVars: []string{"REVA_USERS_PROTOCOL"},
Destination: &cfg.Reva.Users.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9144",
Usage: "Address to bind reva service",
EnvVars: []string{"REVA_USERS_ADDR"},
Destination: &cfg.Reva.Users.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("userprovider"), // TODO preferences
Usage: "--service userprovider [--service otherservice]",
EnvVars: []string{"REVA_USERS_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "ldap",
Usage: "user driver: 'demo', 'json', 'ldap', or 'rest'",
EnvVars: []string{"REVA_USERS_DRIVER"},
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "json-config",
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,
Usage: "Path to users.json file",
EnvVars: []string{"REVA_USERS_JSON"},
Destination: &cfg.Reva.Users.JSON,
},
// REVA
// rest driver
&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,
},
// LDAP
&cli.StringFlag{
Name: "ldap-hostname",
Value: "localhost",
Usage: "LDAP hostname",
EnvVars: []string{"REVA_LDAP_HOSTNAME"},
Destination: &cfg.Reva.LDAP.Hostname,
},
&cli.IntFlag{
Name: "ldap-port",
Value: 9126,
Usage: "LDAP port",
EnvVars: []string{"REVA_LDAP_PORT"},
Destination: &cfg.Reva.LDAP.Port,
},
&cli.StringFlag{
Name: "ldap-base-dn",
Value: "dc=example,dc=org",
Usage: "LDAP basedn",
EnvVars: []string{"REVA_LDAP_BASE_DN"},
Destination: &cfg.Reva.LDAP.BaseDN,
},
&cli.StringFlag{
Name: "ldap-userfilter",
Value: "(&(objectclass=posixAccount)(|(ownclouduuid={{.OpaqueId}})(cn={{.OpaqueId}})))",
Usage: "LDAP filter used when getting a user. The CS3 userid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"REVA_LDAP_USERFILTER"},
Destination: &cfg.Reva.LDAP.UserFilter,
},
&cli.StringFlag{
Name: "ldap-attributefilter",
Value: "(&(objectclass=posixAccount)({{attr}}={{value}}))",
Usage: "LDAP filter used when searching for a user by claim/attribute. {{attr}} will be replaced with the attribute, {{value}} with the value.",
EnvVars: []string{"REVA_LDAP_ATTRIBUTEFILTER"},
Destination: &cfg.Reva.LDAP.AttributeFilter,
},
&cli.StringFlag{
Name: "ldap-findfilter",
Value: "(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))",
Usage: "LDAP filter used when searching for recipients. {{query}} will be replaced with the search query",
EnvVars: []string{"REVA_LDAP_FINDFILTER"},
Destination: &cfg.Reva.LDAP.FindFilter,
},
&cli.StringFlag{
Name: "ldap-groupfilter",
// FIXME the reva implementation needs to use the memberof overlay to get the cn when it only has the uuid,
// because the ldap schema either uses the dn or the member(of) attributes to establish membership
Value: "(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}*))", // This filter will never work
Usage: "LDAP filter used when getting the groups of a user. The CS3 userid properties {{.OpaqueId}} and {{.Idp}} are available.",
EnvVars: []string{"REVA_LDAP_GROUPFILTER"},
Destination: &cfg.Reva.LDAP.GroupFilter,
},
&cli.StringFlag{
Name: "ldap-bind-dn",
Value: "cn=reva,ou=sysusers,dc=example,dc=org",
Usage: "LDAP bind dn",
EnvVars: []string{"REVA_LDAP_BIND_DN"},
Destination: &cfg.Reva.LDAP.BindDN,
},
&cli.StringFlag{
Name: "ldap-bind-password",
Value: "reva",
Usage: "LDAP bind password",
EnvVars: []string{"REVA_LDAP_BIND_PASSWORD"},
Destination: &cfg.Reva.LDAP.BindPassword,
},
&cli.StringFlag{
Name: "ldap-idp",
Value: "https://localhost:9200",
Usage: "Identity provider to use for users",
EnvVars: []string{"REVA_LDAP_IDP"},
Destination: &cfg.Reva.LDAP.IDP,
},
// ldap dn is always the dn
&cli.StringFlag{
Name: "ldap-schema-uid",
Value: "ownclouduuid",
Usage: "LDAP schema uid",
EnvVars: []string{"REVA_LDAP_SCHEMA_UID"},
Destination: &cfg.Reva.LDAP.Schema.UID,
},
&cli.StringFlag{
Name: "ldap-schema-mail",
Value: "mail",
Usage: "LDAP schema mail",
EnvVars: []string{"REVA_LDAP_SCHEMA_MAIL"},
Destination: &cfg.Reva.LDAP.Schema.Mail,
},
&cli.StringFlag{
Name: "ldap-schema-displayName",
Value: "displayname",
Usage: "LDAP schema displayName",
EnvVars: []string{"REVA_LDAP_SCHEMA_DISPLAYNAME"},
Destination: &cfg.Reva.LDAP.Schema.DisplayName,
},
&cli.StringFlag{
Name: "ldap-schema-cn",
Value: "cn",
Usage: "LDAP schema cn",
EnvVars: []string{"REVA_LDAP_SCHEMA_CN"},
Destination: &cfg.Reva.LDAP.Schema.CN,
},
&cli.StringFlag{
Name: "ldap-schema-uidnumber",
Value: "uidnumber",
Usage: "LDAP schema uidnumber",
EnvVars: []string{"REVA_LDAP_SCHEMA_UID_NUMBER"},
Destination: &cfg.Reva.LDAP.Schema.UIDNumber,
},
&cli.StringFlag{
Name: "ldap-schema-gidnumber",
Value: "gidnumber",
Usage: "LDAP schema gidnumber",
EnvVars: []string{"REVA_LDAP_SCHEMA_GIDNUMBER"},
Destination: &cfg.Reva.LDAP.Schema.GIDNumber,
},
&cli.StringFlag{
Name: "rest-client-id",
Value: "",
@@ -269,59 +144,12 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"REVA_REST_TARGET_API"},
Destination: &cfg.Reva.UserRest.TargetAPI,
},
// Services
// Users
&cli.StringFlag{
Name: "network",
Value: "tcp",
Usage: "Network to use for the reva service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"REVA_USERS_NETWORK"},
Destination: &cfg.Reva.Users.Network,
},
&cli.StringFlag{
Name: "protocol",
Value: "grpc",
Usage: "protocol for reva service, can be 'http' or 'grpc'",
EnvVars: []string{"REVA_USERS_PROTOCOL"},
Destination: &cfg.Reva.Users.Protocol,
},
&cli.StringFlag{
Name: "addr",
Value: "0.0.0.0:9144",
Usage: "Address to bind reva service",
EnvVars: []string{"REVA_USERS_ADDR"},
Destination: &cfg.Reva.Users.Addr,
},
&cli.StringFlag{
Name: "url",
Value: "localhost:9144",
Usage: "URL to use for the reva service",
EnvVars: []string{"REVA_USERS_URL"},
Destination: &cfg.Reva.Users.URL,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("userprovider"), // TODO preferences
Usage: "--service userprovider [--service otherservice]",
EnvVars: []string{"REVA_USERS_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: "ldap",
Usage: "user driver: 'demo', 'json', 'ldap', or 'rest'",
EnvVars: []string{"REVA_USERS_DRIVER"},
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "json-config",
Value: "",
Usage: "Path to users.json file",
EnvVars: []string{"REVA_USERS_JSON"},
Destination: &cfg.Reva.Users.JSON,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, LDAPWithConfig(cfg)...)
return flags
}

View File

@@ -186,7 +186,6 @@ apiShareManagement/acceptShares.feature:696
#
# https://github.com/owncloud/product/issues/208 After accepting a share data in the received file cannot be downloaded
apiShareManagement/acceptSharesToSharesFolder.feature:15
apiShareManagement/acceptSharesToSharesFolder.feature:22
#
# https://github.com/owncloud/product/issues/207 Response is empty when accepting a share
apiShareManagement/acceptSharesToSharesFolder.feature:30