configure users and metadata storage separately

This commit is contained in:
Willy Kloucek
2021-10-11 11:39:36 +02:00
parent 5f0cf077ca
commit d74816f242
34 changed files with 1196 additions and 605 deletions
-128
View File
@@ -1,128 +0,0 @@
package command
import (
"github.com/owncloud/ocis/storage/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.Endpoint,
},
"owncloudsql": map[string]interface{}{
"datadirectory": cfg.Reva.Storages.OwnCloudSQL.Root,
"upload_info_dir": cfg.Reva.Storages.OwnCloudSQL.UploadInfoDir,
"sharedirectory": cfg.Reva.Storages.OwnCloudSQL.ShareFolder,
"user_layout": cfg.Reva.Storages.OwnCloudSQL.UserLayout,
"enable_home": cfg.Reva.Storages.OwnCloudSQL.EnableHome,
"dbusername": cfg.Reva.Storages.OwnCloudSQL.DBUsername,
"dbpassword": cfg.Reva.Storages.OwnCloudSQL.DBPassword,
"dbhost": cfg.Reva.Storages.OwnCloudSQL.DBHost,
"dbport": cfg.Reva.Storages.OwnCloudSQL.DBPort,
"dbname": cfg.Reva.Storages.OwnCloudSQL.DBName,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"ocis": map[string]interface{}{
"root": cfg.Reva.Storages.Common.Root,
"enable_home": cfg.Reva.Storages.Common.EnableHome,
"user_layout": cfg.Reva.Storages.Common.UserLayout,
"treetime_accounting": true,
"treesize_accounting": true,
"owner": cfg.Reva.Storages.OCIS.ServiceUserUUID, // the accounts service system account uuid
},
"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,
},
"s3ng": map[string]interface{}{
"root": cfg.Reva.Storages.Common.Root,
"enable_home": cfg.Reva.Storages.Common.EnableHome,
"user_layout": cfg.Reva.Storages.Common.UserLayout,
"s3.region": cfg.Reva.Storages.S3NG.Region,
"s3.access_key": cfg.Reva.Storages.S3NG.AccessKey,
"s3.secret_key": cfg.Reva.Storages.S3NG.SecretKey,
"s3.endpoint": cfg.Reva.Storages.S3NG.Endpoint,
"s3.bucket": cfg.Reva.Storages.S3NG.Bucket,
},
}
}
+1 -1
View File
@@ -204,7 +204,7 @@ func frontendConfigFromStruct(c *cli.Context, cfg *config.Config, filesCfg map[s
"db_host": cfg.Reva.Sharing.UserSQLHost,
"db_port": cfg.Reva.Sharing.UserSQLPort,
"db_name": cfg.Reva.Sharing.UserSQLName,
"namespace": cfg.Reva.Storages.EOS.Root,
"namespace": cfg.Reva.UserStorage.EOS.Root,
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
},
},
+130
View File
@@ -0,0 +1,130 @@
package storagedrivers
import (
"github.com/owncloud/ocis/storage/pkg/config"
)
func HomeDrivers(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.UserStorage.EOS.Root,
"shadow_namespace": cfg.Reva.UserStorage.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.UserStorage.EOS.UploadsNamespace,
"share_folder": cfg.Reva.UserStorage.EOS.ShareFolder,
"eos_binary": cfg.Reva.UserStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.UserStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.UserStorage.EOS.MasterURL,
"slave_url": cfg.Reva.UserStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.UserStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.UserStorage.EOS.SecProtocol,
"keytab": cfg.Reva.UserStorage.EOS.Keytab,
"single_username": cfg.Reva.UserStorage.EOS.SingleUsername,
"enable_logging": cfg.Reva.UserStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.UserStorage.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.UserStorage.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.UserStorage.EOS.Root,
"shadow_namespace": cfg.Reva.UserStorage.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.UserStorage.EOS.UploadsNamespace,
"share_folder": cfg.Reva.UserStorage.EOS.ShareFolder,
"eos_binary": cfg.Reva.UserStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.UserStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.UserStorage.EOS.MasterURL,
"slave_url": cfg.Reva.UserStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.UserStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.UserStorage.EOS.SecProtocol,
"keytab": cfg.Reva.UserStorage.EOS.Keytab,
"single_username": cfg.Reva.UserStorage.EOS.SingleUsername,
"user_layout": cfg.Reva.UserStorage.EOS.UserLayout,
"enable_logging": cfg.Reva.UserStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.UserStorage.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.UserStorage.EOS.GatewaySVC,
},
"eosgrpc": map[string]interface{}{
"namespace": cfg.Reva.UserStorage.EOS.Root,
"shadow_namespace": cfg.Reva.UserStorage.EOS.ShadowNamespace,
"share_folder": cfg.Reva.UserStorage.EOS.ShareFolder,
"eos_binary": cfg.Reva.UserStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.UserStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.UserStorage.EOS.MasterURL,
"master_grpc_uri": cfg.Reva.UserStorage.EOS.GrpcURI,
"slave_url": cfg.Reva.UserStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.UserStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.UserStorage.EOS.SecProtocol,
"keytab": cfg.Reva.UserStorage.EOS.Keytab,
"single_username": cfg.Reva.UserStorage.EOS.SingleUsername,
"user_layout": cfg.Reva.UserStorage.EOS.UserLayout,
"enable_logging": cfg.Reva.UserStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.UserStorage.EOS.UseKeytab,
"enable_home": cfg.Reva.UserStorage.EOS.EnableHome,
"gatewaysvc": cfg.Reva.UserStorage.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.UserStorage.Local.Root,
"share_folder": cfg.Reva.UserStorage.Local.ShareFolder,
},
"localhome": map[string]interface{}{
"root": cfg.Reva.UserStorage.Local.Root,
"share_folder": cfg.Reva.UserStorage.Local.ShareFolder,
"user_layout": cfg.Reva.UserStorage.Local.UserLayout,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.UserStorage.OwnCloud.Root,
"upload_info_dir": cfg.Reva.UserStorage.OwnCloud.UploadInfoDir,
"share_folder": cfg.Reva.UserStorage.OwnCloud.ShareFolder,
"user_layout": cfg.Reva.UserStorage.OwnCloud.UserLayout,
"redis": cfg.Reva.UserStorage.OwnCloud.Redis,
"enable_home": cfg.Reva.UserStorage.OwnCloud.EnableHome,
"scan": cfg.Reva.UserStorage.OwnCloud.Scan,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"owncloudsql": map[string]interface{}{
"datadirectory": cfg.Reva.UserStorage.OwnCloudSQL.Root,
"upload_info_dir": cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir,
"share_folder": cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder,
"user_layout": cfg.Reva.UserStorage.OwnCloudSQL.UserLayout,
"enable_home": cfg.Reva.UserStorage.OwnCloudSQL.EnableHome,
"dbusername": cfg.Reva.UserStorage.OwnCloudSQL.DBUsername,
"dbpassword": cfg.Reva.UserStorage.OwnCloudSQL.DBPassword,
"dbhost": cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
"dbport": cfg.Reva.UserStorage.OwnCloudSQL.DBPort,
"dbname": cfg.Reva.UserStorage.OwnCloudSQL.DBName,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"ocis": map[string]interface{}{
"root": cfg.Reva.UserStorage.OCIS.Root,
"enable_home": cfg.Reva.UserStorage.OCIS.EnableHome,
"user_layout": cfg.Reva.UserStorage.OCIS.UserLayout,
"share_folder": cfg.Reva.UserStorage.OCIS.ShareFolder,
"treetime_accounting": true,
"treesize_accounting": true,
"owner": cfg.Reva.UserStorage.OCIS.ServiceUserUUID, // the accounts service system account uuid
},
"s3": map[string]interface{}{
"region": cfg.Reva.UserStorage.S3.Region,
"access_key": cfg.Reva.UserStorage.S3.AccessKey,
"secret_key": cfg.Reva.UserStorage.S3.SecretKey,
"endpoint": cfg.Reva.UserStorage.S3.Endpoint,
"bucket": cfg.Reva.UserStorage.S3.Bucket,
"prefix": cfg.Reva.UserStorage.S3.Root,
},
"s3ng": map[string]interface{}{
"root": cfg.Reva.UserStorage.S3NG.Root,
"enable_home": cfg.Reva.UserStorage.S3NG.EnableHome,
"user_layout": cfg.Reva.UserStorage.S3NG.UserLayout,
"share_folder": cfg.Reva.UserStorage.S3NG.ShareFolder,
"s3.region": cfg.Reva.UserStorage.S3NG.Region,
"s3.access_key": cfg.Reva.UserStorage.S3NG.AccessKey,
"s3.secret_key": cfg.Reva.UserStorage.S3NG.SecretKey,
"s3.endpoint": cfg.Reva.UserStorage.S3NG.Endpoint,
"s3.bucket": cfg.Reva.UserStorage.S3NG.Bucket,
},
}
}
@@ -0,0 +1,121 @@
package storagedrivers
import (
"github.com/owncloud/ocis/storage/pkg/config"
)
func MetadataDrivers(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.MetadataStorage.EOS.Root,
"shadow_namespace": cfg.Reva.MetadataStorage.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.MetadataStorage.EOS.UploadsNamespace,
"eos_binary": cfg.Reva.MetadataStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.MetadataStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.MetadataStorage.EOS.MasterURL,
"slave_url": cfg.Reva.MetadataStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.MetadataStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.MetadataStorage.EOS.SecProtocol,
"keytab": cfg.Reva.MetadataStorage.EOS.Keytab,
"single_username": cfg.Reva.MetadataStorage.EOS.SingleUsername,
"enable_logging": cfg.Reva.MetadataStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.MetadataStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.MetadataStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.MetadataStorage.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.MetadataStorage.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.MetadataStorage.EOS.Root,
"shadow_namespace": cfg.Reva.MetadataStorage.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.MetadataStorage.EOS.UploadsNamespace,
"eos_binary": cfg.Reva.MetadataStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.MetadataStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.MetadataStorage.EOS.MasterURL,
"slave_url": cfg.Reva.MetadataStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.MetadataStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.MetadataStorage.EOS.SecProtocol,
"keytab": cfg.Reva.MetadataStorage.EOS.Keytab,
"single_username": cfg.Reva.MetadataStorage.EOS.SingleUsername,
"user_layout": cfg.Reva.MetadataStorage.EOS.UserLayout,
"enable_logging": cfg.Reva.MetadataStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.MetadataStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.MetadataStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.MetadataStorage.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.MetadataStorage.EOS.GatewaySVC,
},
"eosgrpc": map[string]interface{}{
"namespace": cfg.Reva.MetadataStorage.EOS.Root,
"shadow_namespace": cfg.Reva.MetadataStorage.EOS.ShadowNamespace,
"eos_binary": cfg.Reva.MetadataStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.MetadataStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.MetadataStorage.EOS.MasterURL,
"master_grpc_uri": cfg.Reva.MetadataStorage.EOS.GrpcURI,
"slave_url": cfg.Reva.MetadataStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.MetadataStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.MetadataStorage.EOS.SecProtocol,
"keytab": cfg.Reva.MetadataStorage.EOS.Keytab,
"single_username": cfg.Reva.MetadataStorage.EOS.SingleUsername,
"user_layout": cfg.Reva.MetadataStorage.EOS.UserLayout,
"enable_logging": cfg.Reva.MetadataStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.MetadataStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.MetadataStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.MetadataStorage.EOS.UseKeytab,
"enable_home": false,
"gatewaysvc": cfg.Reva.MetadataStorage.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.MetadataStorage.Local.Root,
},
"localhome": map[string]interface{}{
"root": cfg.Reva.MetadataStorage.Local.Root,
"user_layout": cfg.Reva.MetadataStorage.Local.UserLayout,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.MetadataStorage.OwnCloud.Root,
"upload_info_dir": cfg.Reva.MetadataStorage.OwnCloud.UploadInfoDir,
"user_layout": cfg.Reva.MetadataStorage.OwnCloud.UserLayout,
"redis": cfg.Reva.MetadataStorage.OwnCloud.Redis,
"enable_home": false,
"scan": cfg.Reva.MetadataStorage.OwnCloud.Scan,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"owncloudsql": map[string]interface{}{
"datadirectory": cfg.Reva.MetadataStorage.OwnCloudSQL.Root,
"upload_info_dir": cfg.Reva.MetadataStorage.OwnCloudSQL.UploadInfoDir,
"user_layout": cfg.Reva.MetadataStorage.OwnCloudSQL.UserLayout,
"enable_home": false,
"dbusername": cfg.Reva.MetadataStorage.OwnCloudSQL.DBUsername,
"dbpassword": cfg.Reva.MetadataStorage.OwnCloudSQL.DBPassword,
"dbhost": cfg.Reva.MetadataStorage.OwnCloudSQL.DBHost,
"dbport": cfg.Reva.MetadataStorage.OwnCloudSQL.DBPort,
"dbname": cfg.Reva.MetadataStorage.OwnCloudSQL.DBName,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"ocis": map[string]interface{}{
"root": cfg.Reva.MetadataStorage.OCIS.Root,
"enable_home": false,
"user_layout": cfg.Reva.MetadataStorage.OCIS.UserLayout,
"treetime_accounting": true,
"treesize_accounting": true,
"owner": cfg.Reva.MetadataStorage.OCIS.ServiceUserUUID, // the accounts service system account uuid
},
"s3": map[string]interface{}{
"region": cfg.Reva.MetadataStorage.S3.Region,
"access_key": cfg.Reva.MetadataStorage.S3.AccessKey,
"secret_key": cfg.Reva.MetadataStorage.S3.SecretKey,
"endpoint": cfg.Reva.MetadataStorage.S3.Endpoint,
"bucket": cfg.Reva.MetadataStorage.S3.Bucket,
"prefix": cfg.Reva.MetadataStorage.S3.Root,
},
"s3ng": map[string]interface{}{
"root": cfg.Reva.MetadataStorage.S3NG.Root,
"enable_home": false,
"user_layout": cfg.Reva.MetadataStorage.S3NG.UserLayout,
"s3.region": cfg.Reva.MetadataStorage.S3NG.Region,
"s3.access_key": cfg.Reva.MetadataStorage.S3NG.AccessKey,
"s3.secret_key": cfg.Reva.MetadataStorage.S3NG.SecretKey,
"s3.endpoint": cfg.Reva.MetadataStorage.S3NG.Endpoint,
"s3.bucket": cfg.Reva.MetadataStorage.S3NG.Bucket,
},
}
}
+131
View File
@@ -0,0 +1,131 @@
package storagedrivers
import (
"github.com/owncloud/ocis/storage/pkg/config"
)
func UserDrivers(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Reva.UserStorage.EOS.Root,
"shadow_namespace": cfg.Reva.UserStorage.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.UserStorage.EOS.UploadsNamespace,
"share_folder": cfg.Reva.UserStorage.EOS.ShareFolder,
"eos_binary": cfg.Reva.UserStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.UserStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.UserStorage.EOS.MasterURL,
"slave_url": cfg.Reva.UserStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.UserStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.UserStorage.EOS.SecProtocol,
"keytab": cfg.Reva.UserStorage.EOS.Keytab,
"single_username": cfg.Reva.UserStorage.EOS.SingleUsername,
"enable_logging": cfg.Reva.UserStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.UserStorage.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.UserStorage.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Reva.UserStorage.EOS.Root,
"shadow_namespace": cfg.Reva.UserStorage.EOS.ShadowNamespace,
"uploads_namespace": cfg.Reva.UserStorage.EOS.UploadsNamespace,
"share_folder": cfg.Reva.UserStorage.EOS.ShareFolder,
"eos_binary": cfg.Reva.UserStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.UserStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.UserStorage.EOS.MasterURL,
"slave_url": cfg.Reva.UserStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.UserStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.UserStorage.EOS.SecProtocol,
"keytab": cfg.Reva.UserStorage.EOS.Keytab,
"single_username": cfg.Reva.UserStorage.EOS.SingleUsername,
"user_layout": cfg.Reva.UserStorage.EOS.UserLayout,
"enable_logging": cfg.Reva.UserStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.UserStorage.EOS.UseKeytab,
"gatewaysvc": cfg.Reva.UserStorage.EOS.GatewaySVC,
},
"eosgrpc": map[string]interface{}{
"namespace": cfg.Reva.UserStorage.EOS.Root,
"shadow_namespace": cfg.Reva.UserStorage.EOS.ShadowNamespace,
"share_folder": cfg.Reva.UserStorage.EOS.ShareFolder,
"eos_binary": cfg.Reva.UserStorage.EOS.EosBinary,
"xrdcopy_binary": cfg.Reva.UserStorage.EOS.XrdcopyBinary,
"master_url": cfg.Reva.UserStorage.EOS.MasterURL,
"master_grpc_uri": cfg.Reva.UserStorage.EOS.GrpcURI,
"slave_url": cfg.Reva.UserStorage.EOS.SlaveURL,
"cache_directory": cfg.Reva.UserStorage.EOS.CacheDirectory,
"sec_protocol": cfg.Reva.UserStorage.EOS.SecProtocol,
"keytab": cfg.Reva.UserStorage.EOS.Keytab,
"single_username": cfg.Reva.UserStorage.EOS.SingleUsername,
"user_layout": cfg.Reva.UserStorage.EOS.UserLayout,
"enable_logging": cfg.Reva.UserStorage.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
"use_keytab": cfg.Reva.UserStorage.EOS.UseKeytab,
"enable_home": false,
"gatewaysvc": cfg.Reva.UserStorage.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Reva.UserStorage.Local.Root,
"share_folder": cfg.Reva.UserStorage.Local.ShareFolder,
},
"localhome": map[string]interface{}{
"root": cfg.Reva.UserStorage.Local.Root,
"share_folder": cfg.Reva.UserStorage.Local.ShareFolder,
"user_layout": cfg.Reva.UserStorage.Local.UserLayout,
},
"owncloud": map[string]interface{}{
"datadirectory": cfg.Reva.UserStorage.OwnCloud.Root,
"upload_info_dir": cfg.Reva.UserStorage.OwnCloud.UploadInfoDir,
"share_folder": cfg.Reva.UserStorage.OwnCloud.ShareFolder,
"user_layout": cfg.Reva.UserStorage.OwnCloud.UserLayout,
"redis": cfg.Reva.UserStorage.OwnCloud.Redis,
"enable_home": false,
"scan": cfg.Reva.UserStorage.OwnCloud.Scan,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"owncloudsql": map[string]interface{}{
"datadirectory": cfg.Reva.UserStorage.OwnCloudSQL.Root,
"upload_info_dir": cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir,
"share_folder": cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder,
"user_layout": cfg.Reva.UserStorage.OwnCloudSQL.UserLayout,
"enable_home": false,
"dbusername": cfg.Reva.UserStorage.OwnCloudSQL.DBUsername,
"dbpassword": cfg.Reva.UserStorage.OwnCloudSQL.DBPassword,
"dbhost": cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
"dbport": cfg.Reva.UserStorage.OwnCloudSQL.DBPort,
"dbname": cfg.Reva.UserStorage.OwnCloudSQL.DBName,
"userprovidersvc": cfg.Reva.Users.Endpoint,
},
"ocis": map[string]interface{}{
"root": cfg.Reva.UserStorage.OCIS.Root,
"enable_home": false,
"user_layout": cfg.Reva.UserStorage.OCIS.UserLayout,
"share_folder": cfg.Reva.UserStorage.OCIS.ShareFolder,
"treetime_accounting": true,
"treesize_accounting": true,
"owner": cfg.Reva.UserStorage.OCIS.ServiceUserUUID, // the accounts service system account uuid
},
"s3": map[string]interface{}{
"enable_home": false,
"region": cfg.Reva.UserStorage.S3.Region,
"access_key": cfg.Reva.UserStorage.S3.AccessKey,
"secret_key": cfg.Reva.UserStorage.S3.SecretKey,
"endpoint": cfg.Reva.UserStorage.S3.Endpoint,
"bucket": cfg.Reva.UserStorage.S3.Bucket,
"prefix": cfg.Reva.UserStorage.S3.Root,
},
"s3ng": map[string]interface{}{
"root": cfg.Reva.UserStorage.S3NG.Root,
"enable_home": false,
"user_layout": cfg.Reva.UserStorage.S3NG.UserLayout,
"share_folder": cfg.Reva.UserStorage.S3NG.ShareFolder,
"s3.region": cfg.Reva.UserStorage.S3NG.Region,
"s3.access_key": cfg.Reva.UserStorage.S3NG.AccessKey,
"s3.secret_key": cfg.Reva.UserStorage.S3NG.SecretKey,
"s3.endpoint": cfg.Reva.UserStorage.S3NG.Endpoint,
"s3.bucket": cfg.Reva.UserStorage.S3NG.Bucket,
},
}
}
+3 -12
View File
@@ -12,6 +12,7 @@ import (
"github.com/gofrs/uuid"
"github.com/oklog/run"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/storage/pkg/command/storagedrivers"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
@@ -43,16 +44,6 @@ 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.OwnCloudSQL.EnableHome = true
cfg.Reva.Storages.S3.EnableHome = true
cfg.Reva.Storages.S3NG.EnableHome = true
}
rcfg := storageHomeConfigFromStruct(c, cfg)
gr.Add(func() error {
@@ -117,7 +108,7 @@ func storageHomeConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageHome.Driver,
"drivers": drivers(cfg),
"drivers": storagedrivers.HomeDrivers(cfg),
"mount_path": cfg.Reva.StorageHome.MountPath,
"mount_id": cfg.Reva.StorageHome.MountID,
"expose_data_server": cfg.Reva.StorageHome.ExposeDataServer,
@@ -134,7 +125,7 @@ func storageHomeConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageHome.HTTPPrefix,
"driver": cfg.Reva.StorageHome.Driver,
"drivers": drivers(cfg),
"drivers": storagedrivers.HomeDrivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,
+3 -30
View File
@@ -13,6 +13,7 @@ import (
"github.com/oklog/run"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/storage/pkg/command/storagedrivers"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
@@ -32,17 +33,6 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
// TODO(refs) at this point it might make sense delegate log flags to each individual storage command.
Flags: append(flagset.StorageMetadata(cfg), flagset.RootWithConfig(cfg)...),
Category: "Extensions",
Before: func(c *cli.Context) error {
storageRoot := c.String("storage-root")
cfg.Reva.Storages.OwnCloud.Root = storageRoot
cfg.Reva.Storages.EOS.Root = storageRoot
cfg.Reva.Storages.Local.Root = storageRoot
cfg.Reva.Storages.S3.Root = storageRoot
cfg.Reva.Storages.Home.Root = storageRoot
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
@@ -58,23 +48,6 @@ func StorageMetadata(cfg *config.Config) *cli.Command {
defer cancel()
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// Disable home because the metadata is stored independently
// of the user. This also means that a valid-token without any user-id
// is allowed to write to the metadata-storage.
cfg.Reva.Storages.Common.EnableHome = false
cfg.Reva.Storages.EOS.EnableHome = false
cfg.Reva.Storages.Local.EnableHome = false
cfg.Reva.Storages.OwnCloud.EnableHome = false
cfg.Reva.Storages.S3.EnableHome = false
// We need this hack because the metadata storage can define STORAGE_METADATA_ROOT which has the same destination as
// STORAGE_DRIVER_OCIS_ROOT. When both variables are set one storage will always be out of sync. Ensure the
// metadata storage root is never overridden. This is the kind of stateful code that make you want to cry blood.
if os.Getenv("STORAGE_METADATA_ROOT") != "" && os.Getenv("STORAGE_DRIVER_OCIS_ROOT") != "" {
cfg.Reva.Storages.Common.Root = os.Getenv("STORAGE_METADATA_ROOT")
}
rcfg := storageMetadataFromStruct(c, cfg)
gr.Add(func() error {
@@ -160,7 +133,7 @@ func storageMetadataFromStruct(c *cli.Context, cfg *config.Config) map[string]in
"storageprovider": map[string]interface{}{
"mount_path": "/meta",
"driver": cfg.Reva.StorageMetadata.Driver,
"drivers": drivers(cfg),
"drivers": storagedrivers.MetadataDrivers(cfg),
"data_server_url": cfg.Reva.StorageMetadata.DataServerURL,
"tmp_folder": cfg.Reva.StorageMetadata.TempFolder,
},
@@ -174,7 +147,7 @@ func storageMetadataFromStruct(c *cli.Context, cfg *config.Config) map[string]in
"dataprovider": map[string]interface{}{
"prefix": "data",
"driver": cfg.Reva.StorageMetadata.Driver,
"drivers": drivers(cfg),
"drivers": storagedrivers.MetadataDrivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": true,
+3 -12
View File
@@ -11,6 +11,7 @@ import (
"github.com/oklog/run"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/storage/pkg/command/storagedrivers"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
"github.com/owncloud/ocis/storage/pkg/server/debug"
@@ -43,16 +44,6 @@ func StorageUsers(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.OwnCloudSQL.EnableHome = true
cfg.Reva.Storages.S3.EnableHome = true
cfg.Reva.Storages.S3NG.EnableHome = true
}
rcfg := storageUsersConfigFromStruct(c, cfg)
gr.Add(func() error {
@@ -117,7 +108,7 @@ func storageUsersConfigFromStruct(c *cli.Context, cfg *config.Config) map[string
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageUsers.Driver,
"drivers": drivers(cfg),
"drivers": storagedrivers.UserDrivers(cfg),
"mount_path": cfg.Reva.StorageUsers.MountPath,
"mount_id": cfg.Reva.StorageUsers.MountID,
"expose_data_server": cfg.Reva.StorageUsers.ExposeDataServer,
@@ -134,7 +125,7 @@ func storageUsersConfigFromStruct(c *cli.Context, cfg *config.Config) map[string
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageUsers.HTTPPrefix,
"driver": cfg.Reva.StorageUsers.Driver,
"drivers": drivers(cfg),
"drivers": storagedrivers.UserDrivers(cfg),
"timeout": 86400,
"insecure": true,
"disable_tus": false,
+4 -3
View File
@@ -201,14 +201,12 @@ type PublicStorage struct {
// StorageConfig combines all available storage driver configuration parts.
type StorageConfig struct {
Home DriverCommon
EOS DriverEOS
Local DriverCommon
OwnCloud DriverOwnCloud
OwnCloudSQL DriverOwnCloudSQL
S3 DriverS3
S3NG DriverS3NG
Common DriverCommon
OCIS DriverOCIS
// TODO checksums ... figure out what that is supposed to do
}
@@ -289,6 +287,8 @@ type DriverEOS struct {
// DriverOCIS defines the available oCIS storage driver configuration.
type DriverOCIS struct {
DriverCommon
ServiceUserUUID string
}
@@ -438,7 +438,8 @@ type Reva struct {
UserOwnCloudSQL UserOwnCloudSQL
OCDav OCDav
Archiver Archiver
Storages StorageConfig
UserStorage StorageConfig
MetadataStorage StorageConfig
// Ports are used to configure which services to start on which port
Frontend FrontendPort
DataGateway DataGatewayPort
-135
View File
@@ -1,135 +0,0 @@
package flagset
import (
"os"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverEOSWithConfig applies cfg to the root flagset
func DriverEOSWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-eos-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.Root, "/eos/dockertest/reva"),
Usage: "Namespace for metadata operations",
EnvVars: []string{"STORAGE_DRIVER_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{"STORAGE_DRIVER_EOS_SHADOW_NAMESPACE"},
Destination: &cfg.Reva.Storages.EOS.ShadowNamespace,
},
&cli.StringFlag{
Name: "storage-eos-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.ShareFolder, "/Shares"),
Usage: "name of the share folder",
EnvVars: []string{"STORAGE_DRIVER_EOS_SHARE_FOLDER"},
Destination: &cfg.Reva.Storages.EOS.ShareFolder,
},
&cli.StringFlag{
Name: "storage-eos-binary",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.EosBinary, "/usr/bin/eos"),
Usage: "Location of the eos binary",
EnvVars: []string{"STORAGE_DRIVER_EOS_BINARY"},
Destination: &cfg.Reva.Storages.EOS.EosBinary,
},
&cli.StringFlag{
Name: "storage-eos-xrdcopy-binary",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.XrdcopyBinary, "/usr/bin/xrdcopy"),
Usage: "Location of the xrdcopy binary",
EnvVars: []string{"STORAGE_DRIVER_EOS_XRDCOPY_BINARY"},
Destination: &cfg.Reva.Storages.EOS.XrdcopyBinary,
},
&cli.StringFlag{
Name: "storage-eos-master-url",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.MasterURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Master EOS MGM",
EnvVars: []string{"STORAGE_DRIVER_EOS_MASTER_URL"},
Destination: &cfg.Reva.Storages.EOS.MasterURL,
},
&cli.StringFlag{
Name: "storage-eos-slave-url",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.SlaveURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Slave EOS MGM",
EnvVars: []string{"STORAGE_DRIVER_EOS_SLAVE_URL"},
Destination: &cfg.Reva.Storages.EOS.SlaveURL,
},
&cli.StringFlag{
Name: "storage-eos-cache-directory",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.CacheDirectory, os.TempDir()),
Usage: "Location on the local fs where to store reads",
EnvVars: []string{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_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{"STORAGE_DRIVER_EOS_SINGLE_USERNAME"},
Destination: &cfg.Reva.Storages.EOS.SingleUsername,
},
&cli.StringFlag{
Name: "storage-eos-layout",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.UserLayout, "{{substr 0 1 .Username}}/{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_DRIVER_EOS_LAYOUT"},
Destination: &cfg.Reva.Storages.EOS.UserLayout,
},
&cli.StringFlag{
Name: "storage-eos-reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.EOS.GatewaySVC, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.Storages.EOS.GatewaySVC,
},
}
}
-41
View File
@@ -1,41 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOCISWithConfig applies cfg to the root flagset
func DriverOCISWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-ocis-root",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.Common.Root, "/var/tmp/ocis/storage/users"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_DRIVER_OCIS_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
},
&cli.BoolFlag{
Name: "storage-ocis-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.Storages.Common.EnableHome, false),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_DRIVER_OCIS_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Common.EnableHome,
},
&cli.StringFlag{
Name: "storage-ocis-layout",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.Common.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_DRIVER_OCIS_LAYOUT"},
Destination: &cfg.Reva.Storages.Common.UserLayout,
},
&cli.StringFlag{
Name: "service-user-uuid",
Value: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
Usage: "uuid of the internal service user",
EnvVars: []string{"STORAGE_DRIVER_OCIS_SERVICE_USER_UUID"},
Destination: &cfg.Reva.Storages.OCIS.ServiceUserUUID,
},
}
}
-62
View File
@@ -1,62 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudWithConfig applies cfg to the root flagset
func DriverOwnCloudWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloud-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloud.Root, "/var/tmp/ocis/storage/owncloud"),
Usage: "the path to the owncloud data directory",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_DATADIR"},
Destination: &cfg.Reva.Storages.OwnCloud.Root,
},
&cli.StringFlag{
Name: "storage-owncloud-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloud.UploadInfoDir, "/var/tmp/ocis/storage/uploadinfo"),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_UPLOADINFO_DIR"},
Destination: &cfg.Reva.Storages.OwnCloud.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloud-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloud.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_SHARE_FOLDER"},
Destination: &cfg.Reva.Storages.OwnCloud.ShareFolder,
},
&cli.BoolFlag{
Name: "storage-owncloud-scan",
Value: flags.OverrideDefaultBool(cfg.Reva.Storages.OwnCloud.Scan, true),
Usage: "scan files on startup to add fileids",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_SCAN"},
Destination: &cfg.Reva.Storages.OwnCloud.Scan,
},
&cli.StringFlag{
Name: "storage-owncloud-redis",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloud.Redis, ":6379"),
Usage: "the address of the redis server",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_REDIS_ADDR"},
Destination: &cfg.Reva.Storages.OwnCloud.Redis,
},
&cli.BoolFlag{
Name: "storage-owncloud-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.Storages.OwnCloud.EnableHome, false),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.OwnCloud.EnableHome,
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloud.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloud.UserLayout,
},
}
}
-83
View File
@@ -1,83 +0,0 @@
package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudSQLWithConfig applies cfg to the root flagset
func DriverOwnCloudSQLWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloudsql-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.Root, "/var/tmp/ocis/storage/owncloud"),
Usage: "the path to the owncloudsql data directory",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_DATADIR"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.Root,
},
&cli.StringFlag{
Name: "storage-owncloudsql-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.UploadInfoDir, "/var/tmp/ocis/storage/uploadinfo"),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_UPLOADINFO_DIR"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloudsql-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_SHARE_FOLDER"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.ShareFolder,
},
&cli.BoolFlag{
Name: "storage-owncloudsql-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.Storages.OwnCloudSQL.EnableHome, false),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.EnableHome,
},
&cli.StringFlag{
Name: "storage-owncloudsql-layout",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.UserLayout, "{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_LAYOUT"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.UserLayout,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbusername",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.DBUsername, "owncloud"),
Usage: `"username for accessing the database" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_DBUSERNAME"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.DBUsername,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbpassword",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.DBPassword, "owncloud"),
Usage: `"password for accessing the database" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_DBPASSWORD"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.DBPassword,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbhost",
Value: cfg.Reva.Storages.OwnCloudSQL.DBHost,
Usage: `"the database hostname or IP address" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_DBHOST"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.DBHost,
},
&cli.IntFlag{
Name: "storage-owncloudsql-dbport",
Value: flags.OverrideDefaultInt(cfg.Reva.Storages.OwnCloudSQL.DBPort, 3306),
Usage: `"port the database listens on" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_DBPORT"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.DBPort,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbname",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.OwnCloudSQL.DBName, "owncloud"),
Usage: `"the database name" `,
EnvVars: []string{"STORAGE_DRIVER_OWNCLOUDSQL_DBNAME"},
Destination: &cfg.Reva.Storages.OwnCloudSQL.DBName,
},
}
}
+2 -1
View File
@@ -3,6 +3,7 @@ package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/userdrivers"
"github.com/urfave/cli/v2"
)
@@ -254,7 +255,7 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, SharingSQLWithConfig(cfg)...)
flags = append(flags, DriverEOSWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverEOSWithConfig(cfg)...)
return flags
}
@@ -0,0 +1,129 @@
package metadatadrivers
import (
"os"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverEOSWithConfig applies cfg to the root flagset
func DriverEOSWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-eos-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.Root, "/eos/dockertest/reva"),
Usage: "Namespace for metadata operations",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.Root,
},
&cli.StringFlag{
Name: "storage-eos-shadow-namespace",
// Defaults to path.Join(c.Namespace, ".shadow")
Usage: "Shadow namespace where share references are stored",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHADOW_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.ShadowNamespace,
},
&cli.StringFlag{
Name: "storage-eos-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.ShareFolder, "/Shares"),
Usage: "name of the share folder",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.EOS.ShareFolder,
},
&cli.StringFlag{
Name: "storage-eos-binary",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.EosBinary, "/usr/bin/eos"),
Usage: "Location of the eos binary",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_BINARY"},
Destination: &cfg.Reva.UserStorage.EOS.EosBinary,
},
&cli.StringFlag{
Name: "storage-eos-xrdcopy-binary",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.XrdcopyBinary, "/usr/bin/xrdcopy"),
Usage: "Location of the xrdcopy binary",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_XRDCOPY_BINARY"},
Destination: &cfg.Reva.UserStorage.EOS.XrdcopyBinary,
},
&cli.StringFlag{
Name: "storage-eos-master-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.MasterURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Master EOS MGM",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_MASTER_URL"},
Destination: &cfg.Reva.UserStorage.EOS.MasterURL,
},
&cli.StringFlag{
Name: "storage-eos-slave-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.SlaveURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Slave EOS MGM",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SLAVE_URL"},
Destination: &cfg.Reva.UserStorage.EOS.SlaveURL,
},
&cli.StringFlag{
Name: "storage-eos-cache-directory",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.CacheDirectory, os.TempDir()),
Usage: "Location on the local fs where to store reads",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_CACHE_DIRECTORY"},
Destination: &cfg.Reva.UserStorage.EOS.CacheDirectory,
},
&cli.BoolFlag{
Name: "storage-eos-enable-logging",
Usage: "Enables logging of the commands executed",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_ENABLE_LOGGING"},
Destination: &cfg.Reva.UserStorage.EOS.EnableLogging,
},
&cli.BoolFlag{
Name: "storage-eos-show-hidden-sysfiles",
Usage: "show internal EOS files like .sys.v# and .sys.a# files.",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SHOW_HIDDEN_SYSFILES"},
Destination: &cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
},
&cli.BoolFlag{
Name: "storage-eos-force-singleuser-mode",
Usage: "force connections to EOS to use SingleUsername",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_FORCE_SINGLEUSER_MODE"},
Destination: &cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
},
&cli.BoolFlag{
Name: "storage-eos-use-keytab",
Usage: "authenticate requests by using an EOS keytab",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_USE_KEYTAB"},
Destination: &cfg.Reva.UserStorage.EOS.UseKeytab,
},
&cli.StringFlag{
Name: "storage-eos-sec-protocol",
Usage: "the xrootd security protocol to use between the server and EOS",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SEC_PROTOCOL"},
Destination: &cfg.Reva.UserStorage.EOS.SecProtocol,
},
&cli.StringFlag{
Name: "storage-eos-keytab",
Usage: "the location of the keytab to use to authenticate to EOS",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_KEYTAB"},
Destination: &cfg.Reva.UserStorage.EOS.Keytab,
},
&cli.StringFlag{
Name: "storage-eos-single-username",
Usage: "the username to use when SingleUserMode is enabled",
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_SINGLE_USERNAME"},
Destination: &cfg.Reva.UserStorage.EOS.SingleUsername,
},
&cli.StringFlag{
Name: "storage-eos-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.UserLayout, "{{substr 0 1 .Username}}/{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_EOS_LAYOUT"},
Destination: &cfg.Reva.UserStorage.EOS.UserLayout,
},
&cli.StringFlag{
Name: "storage-eos-reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.GatewaySVC, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.UserStorage.EOS.GatewaySVC,
},
}
}
@@ -0,0 +1,20 @@
package metadatadrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverLocalWithConfig applies cfg to the root flagset
func DriverLocalWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-local-root",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.Local.Root, "/var/tmp/ocis/storage/local"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_METADATA_DRIVER_LOCAL_ROOT"},
Destination: &cfg.Reva.MetadataStorage.Local.Root,
},
}
}
@@ -0,0 +1,34 @@
package metadatadrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOCISWithConfig applies cfg to the root flagset
func DriverOCISWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-ocis-root",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OCIS.Root, "/var/tmp/ocis/storage/metadata"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_ROOT"},
Destination: &cfg.Reva.MetadataStorage.OCIS.Root,
},
&cli.StringFlag{
Name: "storage-ocis-layout",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OCIS.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.OCIS.UserLayout,
},
&cli.StringFlag{
Name: "service-user-uuid",
Value: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
Usage: "uuid of the internal service user",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OCIS_SERVICE_USER_UUID"},
Destination: &cfg.Reva.MetadataStorage.OCIS.ServiceUserUUID,
},
}
}
@@ -0,0 +1,55 @@
package metadatadrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudWithConfig applies cfg to the root flagset
func DriverOwnCloudWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloud-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloud.Root, "/var/tmp/ocis/storage/owncloud"),
Usage: "the path to the owncloud data directory",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUD_DATADIR"},
Destination: &cfg.Reva.MetadataStorage.OwnCloud.Root,
},
&cli.StringFlag{
Name: "storage-owncloud-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloud.UploadInfoDir, "/var/tmp/ocis/storage/uploadinfo"),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUD_UPLOADINFO_DIR"},
Destination: &cfg.Reva.MetadataStorage.OwnCloud.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloud-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloud.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUD_SHARE_FOLDER"},
Destination: &cfg.Reva.MetadataStorage.OwnCloud.ShareFolder,
},
&cli.BoolFlag{
Name: "storage-owncloud-scan",
Value: flags.OverrideDefaultBool(cfg.Reva.MetadataStorage.OwnCloud.Scan, true),
Usage: "scan files on startup to add fileids",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUD_SCAN"},
Destination: &cfg.Reva.MetadataStorage.OwnCloud.Scan,
},
&cli.StringFlag{
Name: "storage-owncloud-redis",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloud.Redis, ":6379"),
Usage: "the address of the redis server",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUD_REDIS_ADDR"},
Destination: &cfg.Reva.MetadataStorage.OwnCloud.Redis,
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloud.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.OwnCloud.UserLayout,
},
}
}
@@ -0,0 +1,76 @@
package metadatadrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudSQLWithConfig applies cfg to the root flagset
func DriverOwnCloudSQLWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloudsql-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.Root, "/var/tmp/ocis/storage/owncloud"),
Usage: "the path to the owncloudsql data directory",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_DATADIR"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.Root,
},
&cli.StringFlag{
Name: "storage-owncloudsql-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.UploadInfoDir, "/var/tmp/ocis/storage/uploadinfo"),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_UPLOADINFO_DIR"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloudsql-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_SHARE_FOLDER"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.ShareFolder,
},
&cli.StringFlag{
Name: "storage-owncloudsql-layout",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.UserLayout, "{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.UserLayout,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbusername",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.DBUsername, "owncloud"),
Usage: `"username for accessing the database" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_DBUSERNAME"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.DBUsername,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbpassword",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.DBPassword, "owncloud"),
Usage: `"password for accessing the database" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_DBPASSWORD"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.DBPassword,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbhost",
Value: cfg.Reva.MetadataStorage.OwnCloudSQL.DBHost,
Usage: `"the database hostname or IP address" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_DBHOST"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.DBHost,
},
&cli.IntFlag{
Name: "storage-owncloudsql-dbport",
Value: flags.OverrideDefaultInt(cfg.Reva.MetadataStorage.OwnCloudSQL.DBPort, 3306),
Usage: `"port the database listens on" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_DBPORT"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.DBPort,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbname",
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.OwnCloudSQL.DBName, "owncloud"),
Usage: `"the database name" `,
EnvVars: []string{"STORAGE_METADATA_DRIVER_OWNCLOUDSQL_DBNAME"},
Destination: &cfg.Reva.MetadataStorage.OwnCloudSQL.DBName,
},
}
}
@@ -1,4 +1,4 @@
package flagset
package metadatadrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
@@ -11,59 +11,52 @@ func DriverS3NGWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-s3ng-root",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.Common.Root, "/var/tmp/ocis/storage/users"),
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.S3NG.Root, "/var/tmp/ocis/storage/metadata"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_DRIVER_S3NG_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
},
&cli.BoolFlag{
Name: "storage-s3ng-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.Storages.Common.EnableHome, false),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_DRIVER_S3NG_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Common.EnableHome,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ROOT"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Root,
},
&cli.StringFlag{
Name: "storage-s3ng-layout",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.Common.UserLayout, "{{.Id.OpaqueId}}"),
Value: flags.OverrideDefaultString(cfg.Reva.MetadataStorage.S3NG.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_DRIVER_S3NG_LAYOUT"},
Destination: &cfg.Reva.Storages.Common.UserLayout,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_LAYOUT"},
Destination: &cfg.Reva.MetadataStorage.S3NG.UserLayout,
},
&cli.StringFlag{
Name: "storage-s3ng-region",
Value: "default",
Usage: `"the s3 region" `,
EnvVars: []string{"STORAGE_DRIVER_S3NG_REGION"},
Destination: &cfg.Reva.Storages.S3NG.Region,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_REGION"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Region,
},
&cli.StringFlag{
Name: "storage-s3ng-accesskey",
Value: "",
Usage: `"the s3 access key" `,
EnvVars: []string{"STORAGE_DRIVER_S3NG_ACCESS_KEY"},
Destination: &cfg.Reva.Storages.S3NG.AccessKey,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ACCESS_KEY"},
Destination: &cfg.Reva.MetadataStorage.S3NG.AccessKey,
},
&cli.StringFlag{
Name: "storage-s3ng-secretkey",
Value: "",
Usage: `"the secret s3 api key" `,
EnvVars: []string{"STORAGE_DRIVER_S3NG_SECRET_KEY"},
Destination: &cfg.Reva.Storages.S3NG.SecretKey,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_SECRET_KEY"},
Destination: &cfg.Reva.MetadataStorage.S3NG.SecretKey,
},
&cli.StringFlag{
Name: "storage-s3ng-endpoint",
Value: "",
Usage: `"s3 compatible API endpoint" `,
EnvVars: []string{"STORAGE_DRIVER_S3NG_ENDPOINT"},
Destination: &cfg.Reva.Storages.S3NG.Endpoint,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_ENDPOINT"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Endpoint,
},
&cli.StringFlag{
Name: "storage-s3ng-bucket",
Value: "",
Usage: `"bucket where the data will be stored in`,
EnvVars: []string{"STORAGE_DRIVER_S3NG_BUCKET"},
Destination: &cfg.Reva.Storages.S3NG.Bucket,
EnvVars: []string{"STORAGE_METADATA_DRIVER_S3NG_BUCKET"},
Destination: &cfg.Reva.MetadataStorage.S3NG.Bucket,
},
}
}
+7 -13
View File
@@ -3,6 +3,7 @@ package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/userdrivers"
"github.com/urfave/cli/v2"
)
@@ -126,13 +127,6 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"STORAGE_HOME_TMP_FOLDER"},
Destination: &cfg.Reva.StorageHome.TempFolder,
},
&cli.BoolFlag{
Name: "enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.Storages.Home.EnableHome, true),
Usage: "enable the creation of home directories",
EnvVars: []string{"STORAGE_HOME_ENABLE_HOME"},
Destination: &cfg.Reva.Storages.Home.EnableHome,
},
// some drivers need to look up users at the gateway
@@ -159,12 +153,12 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
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, DriverOwnCloudSQLWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
flags = append(flags, DriverS3NGWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverEOSWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverLocalWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudSQLWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOCISWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverS3NGWithConfig(cfg)...)
return flags
}
+6 -14
View File
@@ -3,6 +3,7 @@ package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/metadatadrivers"
"github.com/urfave/cli/v2"
)
@@ -89,23 +90,14 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
},
}
f = append(f,
&cli.StringFlag{
Name: "storage-root",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.Common.Root, "/var/tmp/ocis/storage/metadata"),
Usage: "the path to the metadata storage root",
EnvVars: []string{"STORAGE_METADATA_ROOT"},
Destination: &cfg.Reva.Storages.Common.Root,
},
)
f = append(f, TracingWithConfig(cfg)...)
f = append(f, DebugWithConfig(cfg)...)
f = append(f, SecretWithConfig(cfg)...)
f = append(f, DriverEOSWithConfig(cfg)...)
f = append(f, DriverLocalWithConfig(cfg)...)
f = append(f, DriverOwnCloudWithConfig(cfg)...)
f = append(f, DriverOCISWithConfig(cfg)...)
f = append(f, DriverS3NGWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverEOSWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverLocalWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverOwnCloudWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverOCISWithConfig(cfg)...)
f = append(f, metadatadrivers.DriverS3NGWithConfig(cfg)...)
return f
+7 -6
View File
@@ -3,6 +3,7 @@ package flagset
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset/userdrivers"
"github.com/urfave/cli/v2"
)
@@ -149,12 +150,12 @@ func StorageUsersWithConfig(cfg *config.Config) []cli.Flag {
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, DriverOwnCloudSQLWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)
flags = append(flags, DriverS3NGWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverEOSWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverLocalWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOwnCloudSQLWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverOCISWithConfig(cfg)...)
flags = append(flags, userdrivers.DriverS3NGWithConfig(cfg)...)
return flags
}
@@ -0,0 +1,135 @@
package userdrivers
import (
"os"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverEOSWithConfig applies cfg to the root flagset
func DriverEOSWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-eos-namespace",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.Root, "/eos/dockertest/reva"),
Usage: "Namespace for metadata operations",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.Root,
},
&cli.StringFlag{
Name: "storage-eos-shadow-namespace",
// Defaults to path.Join(c.Namespace, ".shadow")
Usage: "Shadow namespace where share references are stored",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHADOW_NAMESPACE"},
Destination: &cfg.Reva.UserStorage.EOS.ShadowNamespace,
},
&cli.StringFlag{
Name: "storage-eos-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.ShareFolder, "/Shares"),
Usage: "name of the share folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.EOS.ShareFolder,
},
&cli.StringFlag{
Name: "storage-eos-binary",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.EosBinary, "/usr/bin/eos"),
Usage: "Location of the eos binary",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_BINARY"},
Destination: &cfg.Reva.UserStorage.EOS.EosBinary,
},
&cli.StringFlag{
Name: "storage-eos-xrdcopy-binary",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.XrdcopyBinary, "/usr/bin/xrdcopy"),
Usage: "Location of the xrdcopy binary",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_XRDCOPY_BINARY"},
Destination: &cfg.Reva.UserStorage.EOS.XrdcopyBinary,
},
&cli.StringFlag{
Name: "storage-eos-master-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.MasterURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Master EOS MGM",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_MASTER_URL"},
Destination: &cfg.Reva.UserStorage.EOS.MasterURL,
},
&cli.StringFlag{
Name: "storage-eos-slave-url",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.SlaveURL, "root://eos-mgm1.eoscluster.cern.ch:1094"),
Usage: "URL of the Slave EOS MGM",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SLAVE_URL"},
Destination: &cfg.Reva.UserStorage.EOS.SlaveURL,
},
&cli.StringFlag{
Name: "storage-eos-cache-directory",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.CacheDirectory, os.TempDir()),
Usage: "Location on the local fs where to store reads",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_CACHE_DIRECTORY"},
Destination: &cfg.Reva.UserStorage.EOS.CacheDirectory,
},
&cli.BoolFlag{
Name: "storage-eos-enable-logging",
Usage: "Enables logging of the commands executed",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_ENABLE_LOGGING"},
Destination: &cfg.Reva.UserStorage.EOS.EnableLogging,
},
&cli.BoolFlag{
Name: "storage-eos-show-hidden-sysfiles",
Usage: "show internal EOS files like .sys.v# and .sys.a# files.",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SHOW_HIDDEN_SYSFILES"},
Destination: &cfg.Reva.UserStorage.EOS.ShowHiddenSysFiles,
},
&cli.BoolFlag{
Name: "storage-eos-force-singleuser-mode",
Usage: "force connections to EOS to use SingleUsername",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_FORCE_SINGLEUSER_MODE"},
Destination: &cfg.Reva.UserStorage.EOS.ForceSingleUserMode,
},
&cli.BoolFlag{
Name: "storage-eos-use-keytab",
Usage: "authenticate requests by using an EOS keytab",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_USE_KEYTAB"},
Destination: &cfg.Reva.UserStorage.EOS.UseKeytab,
},
&cli.BoolFlag{
Name: "storage-eos-enable-home",
Usage: "enable the creation of home directories",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_ENABLE_HOME"},
Destination: &cfg.Reva.UserStorage.EOS.EnableHome,
},
&cli.StringFlag{
Name: "storage-eos-sec-protocol",
Usage: "the xrootd security protocol to use between the server and EOS",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SEC_PROTOCOL"},
Destination: &cfg.Reva.UserStorage.EOS.SecProtocol,
},
&cli.StringFlag{
Name: "storage-eos-keytab",
Usage: "the location of the keytab to use to authenticate to EOS",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_KEYTAB"},
Destination: &cfg.Reva.UserStorage.EOS.Keytab,
},
&cli.StringFlag{
Name: "storage-eos-single-username",
Usage: "the username to use when SingleUserMode is enabled",
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_SINGLE_USERNAME"},
Destination: &cfg.Reva.UserStorage.EOS.SingleUsername,
},
&cli.StringFlag{
Name: "storage-eos-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.UserLayout, "{{substr 0 1 .Username}}/{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.UsernameLower}} and {{.Provider}} also supports prefixing dirs: "{{.UsernamePrefixCount.2}}/{{.UsernameLower}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_EOS_LAYOUT"},
Destination: &cfg.Reva.UserStorage.EOS.UserLayout,
},
&cli.StringFlag{
Name: "storage-eos-reva-gateway-addr",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.EOS.GatewaySVC, "127.0.0.1:9142"),
Usage: "Address of REVA gateway endpoint",
EnvVars: []string{"REVA_GATEWAY"},
Destination: &cfg.Reva.UserStorage.EOS.GatewaySVC,
},
}
}
@@ -1,4 +1,4 @@
package flagset
package userdrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
@@ -11,10 +11,10 @@ func DriverLocalWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-local-root",
Value: flags.OverrideDefaultString(cfg.Reva.Storages.Local.Root, "/var/tmp/ocis/storage/local"),
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.Local.Root, "/var/tmp/ocis/storage/local"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_DRIVER_LOCAL_ROOT"},
Destination: &cfg.Reva.Storages.Local.Root,
EnvVars: []string{"STORAGE_USERS_DRIVER_LOCAL_ROOT"},
Destination: &cfg.Reva.UserStorage.Local.Root,
},
}
}
@@ -0,0 +1,48 @@
package userdrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOCISWithConfig applies cfg to the root flagset
func DriverOCISWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-ocis-root",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OCIS.Root, "/var/tmp/ocis/storage/users"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_ROOT"},
Destination: &cfg.Reva.UserStorage.OCIS.Root,
},
&cli.BoolFlag{
Name: "storage-ocis-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.UserStorage.OCIS.EnableHome, true),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_ENABLE_HOME"},
Destination: &cfg.Reva.UserStorage.OCIS.EnableHome,
},
&cli.StringFlag{
Name: "storage-ocis-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OCIS.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_LAYOUT"},
Destination: &cfg.Reva.UserStorage.OCIS.UserLayout,
},
&cli.StringFlag{
Name: "storage-ocis-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OCIS.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.OCIS.ShareFolder,
},
&cli.StringFlag{
Name: "service-user-uuid",
Value: "95cb8724-03b2-11eb-a0a6-c33ef8ef53ad",
Usage: "uuid of the internal service user",
EnvVars: []string{"STORAGE_USERS_DRIVER_OCIS_SERVICE_USER_UUID"},
Destination: &cfg.Reva.UserStorage.OCIS.ServiceUserUUID,
},
}
}
@@ -0,0 +1,62 @@
package userdrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudWithConfig applies cfg to the root flagset
func DriverOwnCloudWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloud-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.Root, "/var/tmp/ocis/storage/owncloud"),
Usage: "the path to the owncloud data directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_DATADIR"},
Destination: &cfg.Reva.UserStorage.OwnCloud.Root,
},
&cli.StringFlag{
Name: "storage-owncloud-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.UploadInfoDir, "/var/tmp/ocis/storage/uploadinfo"),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_UPLOADINFO_DIR"},
Destination: &cfg.Reva.UserStorage.OwnCloud.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloud-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.OwnCloud.ShareFolder,
},
&cli.BoolFlag{
Name: "storage-owncloud-scan",
Value: flags.OverrideDefaultBool(cfg.Reva.UserStorage.OwnCloud.Scan, true),
Usage: "scan files on startup to add fileids",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_SCAN"},
Destination: &cfg.Reva.UserStorage.OwnCloud.Scan,
},
&cli.StringFlag{
Name: "storage-owncloud-redis",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.Redis, ":6379"),
Usage: "the address of the redis server",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_REDIS_ADDR"},
Destination: &cfg.Reva.UserStorage.OwnCloud.Redis,
},
&cli.BoolFlag{
Name: "storage-owncloud-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.UserStorage.OwnCloud.EnableHome, false),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_ENABLE_HOME"},
Destination: &cfg.Reva.UserStorage.OwnCloud.EnableHome,
},
&cli.StringFlag{
Name: "storage-owncloud-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloud.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUD_LAYOUT"},
Destination: &cfg.Reva.UserStorage.OwnCloud.UserLayout,
},
}
}
@@ -0,0 +1,83 @@
package userdrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverOwnCloudSQLWithConfig applies cfg to the root flagset
func DriverOwnCloudSQLWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-owncloudsql-datadir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.Root, "/var/tmp/ocis/storage/owncloud"),
Usage: "the path to the owncloudsql data directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DATADIR"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.Root,
},
&cli.StringFlag{
Name: "storage-owncloudsql-uploadinfo-dir",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir, "/var/tmp/ocis/storage/uploadinfo"),
Usage: "the path to the tus upload info directory",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_UPLOADINFO_DIR"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.UploadInfoDir,
},
&cli.StringFlag{
Name: "storage-owncloudsql-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.ShareFolder,
},
&cli.BoolFlag{
Name: "storage-owncloudsql-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.UserStorage.OwnCloudSQL.EnableHome, true),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_ENABLE_HOME"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.EnableHome,
},
&cli.StringFlag{
Name: "storage-owncloudsql-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.UserLayout, "{{.Username}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_LAYOUT"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.UserLayout,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbusername",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.DBUsername, "owncloud"),
Usage: `"username for accessing the database" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBUSERNAME"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBUsername,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbpassword",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.DBPassword, "owncloud"),
Usage: `"password for accessing the database" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBPASSWORD"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBPassword,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbhost",
Value: cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
Usage: `"the database hostname or IP address" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBHOST"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBHost,
},
&cli.IntFlag{
Name: "storage-owncloudsql-dbport",
Value: flags.OverrideDefaultInt(cfg.Reva.UserStorage.OwnCloudSQL.DBPort, 3306),
Usage: `"port the database listens on" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBPORT"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBPort,
},
&cli.StringFlag{
Name: "storage-owncloudsql-dbname",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.OwnCloudSQL.DBName, "owncloud"),
Usage: `"the database name" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_OWNCLOUDSQL_DBNAME"},
Destination: &cfg.Reva.UserStorage.OwnCloudSQL.DBName,
},
}
}
@@ -0,0 +1,76 @@
package userdrivers
import (
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
"github.com/urfave/cli/v2"
)
// DriverS3NGWithConfig applies cfg to the root flagset
func DriverS3NGWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-s3ng-root",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.Root, "/var/tmp/ocis/storage/users"),
Usage: "the path to the local storage root",
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ROOT"},
Destination: &cfg.Reva.UserStorage.S3NG.Root,
},
&cli.BoolFlag{
Name: "storage-s3ng-enable-home",
Value: flags.OverrideDefaultBool(cfg.Reva.UserStorage.S3NG.EnableHome, true),
Usage: "enable the creation of home storages",
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ENABLE_HOME"},
Destination: &cfg.Reva.UserStorage.S3NG.EnableHome,
},
&cli.StringFlag{
Name: "storage-s3ng-layout",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.UserLayout, "{{.Id.OpaqueId}}"),
Usage: `"layout of the users home dir path on disk, in addition to {{.Username}}, {{.Mail}}, {{.Id.OpaqueId}}, {{.Id.Idp}} also supports prefixing dirs: "{{substr 0 1 .Username}}/{{.Username}}" will turn "Einstein" into "Ei/Einstein" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_LAYOUT"},
Destination: &cfg.Reva.UserStorage.S3NG.UserLayout,
},
&cli.StringFlag{
Name: "storage-s3ng-share-folder",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.ShareFolder, "/Shares"),
Usage: "name of the shares folder",
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SHARE_FOLDER"},
Destination: &cfg.Reva.UserStorage.S3NG.ShareFolder,
},
&cli.StringFlag{
Name: "storage-s3ng-region",
Value: flags.OverrideDefaultString(cfg.Reva.UserStorage.S3NG.Root, "default"),
Usage: `"the s3 region" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_REGION"},
Destination: &cfg.Reva.UserStorage.S3NG.Region,
},
&cli.StringFlag{
Name: "storage-s3ng-accesskey",
Value: "",
Usage: `"the s3 access key" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ACCESS_KEY"},
Destination: &cfg.Reva.UserStorage.S3NG.AccessKey,
},
&cli.StringFlag{
Name: "storage-s3ng-secretkey",
Value: "",
Usage: `"the secret s3 api key" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_SECRET_KEY"},
Destination: &cfg.Reva.UserStorage.S3NG.SecretKey,
},
&cli.StringFlag{
Name: "storage-s3ng-endpoint",
Value: "",
Usage: `"s3 compatible API endpoint" `,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_ENDPOINT"},
Destination: &cfg.Reva.UserStorage.S3NG.Endpoint,
},
&cli.StringFlag{
Name: "storage-s3ng-bucket",
Value: "",
Usage: `"bucket where the data will be stored in`,
EnvVars: []string{"STORAGE_USERS_DRIVER_S3NG_BUCKET"},
Destination: &cfg.Reva.UserStorage.S3NG.Bucket,
},
}
}