make storage users config similar to other services

This commit is contained in:
David Christofas
2022-04-25 15:43:56 +02:00
parent 12c14e3135
commit f40ec3c934
9 changed files with 502 additions and 49 deletions
@@ -9,12 +9,12 @@ import (
"github.com/cs3org/reva/v2/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/oklog/run"
"github.com/owncloud/ocis/extensions/storage/pkg/command/storagedrivers"
"github.com/owncloud/ocis/extensions/storage/pkg/config"
"github.com/owncloud/ocis/extensions/storage-users/pkg/config"
"github.com/owncloud/ocis/extensions/storage/pkg/server/debug"
"github.com/owncloud/ocis/extensions/storage/pkg/tracing"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/owncloud/ocis/ocis-pkg/tracing"
"github.com/thejerf/suture/v4"
"github.com/urfave/cli/v2"
)
@@ -24,17 +24,20 @@ func StorageUsers(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-users",
Usage: "start storage-users service",
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg, "storage-userprovider")
},
// Before: func(c *cli.Context) error {
// return ParseConfig(c, cfg, "storage-userprovider")
// },
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
tracing.Configure(cfg, logger)
logCfg := cfg.Logging
logger := log.NewLogger(
log.Level(logCfg.Level),
log.File(logCfg.File),
log.Pretty(logCfg.Pretty),
log.Color(logCfg.Color),
)
tracing.Configure(cfg.Tracing.Enabled, cfg.Tracing.Type, logger)
gr := run.Group{}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
uuid := uuid.Must(uuid.NewV4())
@@ -59,10 +62,12 @@ func StorageUsers(cfg *config.Config) *cli.Command {
debugServer, err := debug.Server(
debug.Name(c.Command.Name+"-debug"),
debug.Addr(cfg.Reva.StorageUsers.DebugAddr),
debug.Addr(cfg.Debug.Addr),
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
debug.Pprof(cfg.Debug.Pprof),
debug.Zpages(cfg.Debug.Zpages),
debug.Token(cfg.Debug.Token),
)
if err != nil {
@@ -74,7 +79,7 @@ func StorageUsers(cfg *config.Config) *cli.Command {
cancel()
})
if !cfg.Reva.StorageUsers.Supervised {
if !cfg.Supervised {
sync.Trap(&gr, cancel)
}
@@ -87,57 +92,56 @@ func StorageUsers(cfg *config.Config) *cli.Command {
func storageUsersConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]interface{} {
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"max_cpus": cfg.Reva.StorageUsers.MaxCPUs,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": c.Command.Name,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.Reva.JWTSecret,
"gatewaysvc": cfg.Reva.Gateway.Endpoint,
"skip_user_groups_in_token": cfg.Reva.SkipUserGroupsInToken,
"jwt_secret": cfg.JWTSecret,
"gatewaysvc": cfg.GatewayEndpoint,
"skip_user_groups_in_token": cfg.SkipUserGroupsInToken,
},
"grpc": map[string]interface{}{
"network": cfg.Reva.StorageUsers.GRPCNetwork,
"address": cfg.Reva.StorageUsers.GRPCAddr,
"network": cfg.GRPC.Protocol,
"address": cfg.GRPC.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"storageprovider": map[string]interface{}{
"driver": cfg.Reva.StorageUsers.Driver,
"drivers": storagedrivers.UserDrivers(cfg),
"mount_id": cfg.Reva.StorageUsers.MountID,
"expose_data_server": cfg.Reva.StorageUsers.ExposeDataServer,
"data_server_url": cfg.Reva.StorageUsers.DataServerURL,
"tmp_folder": cfg.Reva.StorageUsers.TempFolder,
"driver": cfg.Driver,
"drivers": config.UserDrivers(cfg),
"mount_id": cfg.MountID,
"expose_data_server": cfg.ExposeDataServer,
"data_server_url": cfg.DataServerURL,
"tmp_folder": cfg.TempFolder,
},
},
"interceptors": map[string]interface{}{
"eventsmiddleware": map[string]interface{}{
"group": "sharing",
"type": "nats",
"address": cfg.Reva.Sharing.Events.Address,
"clusterID": cfg.Reva.Sharing.Events.ClusterID,
"address": cfg.Events.Addr,
"clusterID": cfg.Events.ClusterID,
},
},
},
"http": map[string]interface{}{
"network": cfg.Reva.StorageUsers.HTTPNetwork,
"address": cfg.Reva.StorageUsers.HTTPAddr,
"network": cfg.HTTP.Protocol,
"address": cfg.HTTP.Addr,
// TODO build services dynamically
"services": map[string]interface{}{
"dataprovider": map[string]interface{}{
"prefix": cfg.Reva.StorageUsers.HTTPPrefix,
"driver": cfg.Reva.StorageUsers.Driver,
"drivers": storagedrivers.UserDrivers(cfg),
"prefix": cfg.HTTP.Prefix,
"driver": cfg.Driver,
"drivers": config.UserDrivers(cfg),
"timeout": 86400,
"insecure": cfg.Reva.StorageUsers.DataProvider.Insecure,
"insecure": cfg.DataProviderInsecure,
"disable_tus": false,
},
},
},
}
if cfg.Reva.StorageUsers.ReadOnly {
if cfg.ReadOnly {
gcfg := rcfg["grpc"].(map[string]interface{})
gcfg["interceptors"] = map[string]interface{}{
"readonly": map[string]interface{}{},
@@ -153,28 +157,29 @@ type StorageUsersSutureService struct {
// NewStorageUsersSutureService creates a new storage.StorageUsersSutureService
func NewStorageUsers(cfg *ociscfg.Config) suture.Service {
cfg.Storage.Commons = cfg.Commons
cfg.StorageUsers.Commons = cfg.Commons
return StorageUsersSutureService{
cfg: cfg.Storage,
cfg: cfg.StorageUsers,
}
}
func (s StorageUsersSutureService) Serve(ctx context.Context) error {
s.cfg.Reva.StorageUsers.Context = ctx
// s.cfg.Reva.StorageUsers.Context = ctx
cmd := StorageUsers(s.cfg)
f := &flag.FlagSet{}
cmdFlags := StorageUsers(s.cfg).Flags
cmdFlags := cmd.Flags
for k := range cmdFlags {
if err := cmdFlags[k].Apply(f); err != nil {
return err
}
}
cliCtx := cli.NewContext(nil, f, nil)
if StorageUsers(s.cfg).Before != nil {
if err := StorageUsers(s.cfg).Before(cliCtx); err != nil {
if cmd.Before != nil {
if err := cmd.Before(cliCtx); err != nil {
return err
}
}
if err := StorageUsers(s.cfg).Action(cliCtx); err != nil {
if err := cmd.Action(cliCtx); err != nil {
return err
}
@@ -0,0 +1,196 @@
package config
import (
"context"
"github.com/owncloud/ocis/ocis-pkg/shared"
)
type Config struct {
*shared.Commons `yaml:"-"`
Service Service `yaml:"-"`
Tracing *Tracing `yaml:"tracing"`
Logging *Logging `yaml:"log"`
Debug Debug `yaml:"debug"`
Supervised bool
GRPC GRPCConfig `yaml:"grpc"`
HTTP HTTPConfig `yaml:"http"`
Context context.Context
JWTSecret string
GatewayEndpoint string
SkipUserGroupsInToken bool
Driver string `yaml:"driver" env:"STORAGE_METADATA_AUTH_PROVIDER" desc:"The auth provider which should be used by the service"`
Drivers Drivers `yaml:"drivers"`
DataServerURL string
TempFolder string
DataProviderInsecure bool
Events Events
MountID string
ExposeDataServer bool
ReadOnly bool
}
type Tracing struct {
Enabled bool `yaml:"enabled" env:"OCIS_TRACING_ENABLED;STORAGE_METADATA_TRACING_ENABLED" desc:"Activates tracing."`
Type string `yaml:"type" env:"OCIS_TRACING_TYPE;STORAGE_METADATA_TRACING_TYPE"`
Endpoint string `yaml:"endpoint" env:"OCIS_TRACING_ENDPOINT;STORAGE_METADATA_TRACING_ENDPOINT" desc:"The endpoint to the tracing collector."`
Collector string `yaml:"collector" env:"OCIS_TRACING_COLLECTOR;STORAGE_METADATA_TRACING_COLLECTOR"`
}
type Logging struct {
Level string `yaml:"level" env:"OCIS_LOG_LEVEL;STORAGE_METADATA_LOG_LEVEL" desc:"The log level."`
Pretty bool `yaml:"pretty" env:"OCIS_LOG_PRETTY;STORAGE_METADATA_LOG_PRETTY" desc:"Activates pretty log output."`
Color bool `yaml:"color" env:"OCIS_LOG_COLOR;STORAGE_METADATA_LOG_COLOR" desc:"Activates colorized log output."`
File string `yaml:"file" env:"OCIS_LOG_FILE;STORAGE_METADATA_LOG_FILE" desc:"The target log file."`
}
type Service struct {
Name string `yaml:"-"`
}
type Debug struct {
Addr string `yaml:"addr" env:"STORAGE_METADATA_DEBUG_ADDR"`
Token string `yaml:"token" env:"STORAGE_METADATA_DEBUG_TOKEN"`
Pprof bool `yaml:"pprof" env:"STORAGE_METADATA_DEBUG_PPROF"`
Zpages bool `yaml:"zpages" env:"STORAGE_METADATA_DEBUG_ZPAGES"`
}
type GRPCConfig struct {
Addr string `yaml:"addr" env:"STORAGE_METADATA_GRPC_ADDR" desc:"The address of the grpc service."`
Protocol string `yaml:"protocol" env:"STORAGE_METADATA_GRPC_PROTOCOL" desc:"The transport protocol of the grpc service."`
}
type HTTPConfig struct {
Addr string `yaml:"addr" env:"STORAGE_METADATA_GRPC_ADDR" desc:"The address of the grpc service."`
Protocol string `yaml:"protocol" env:"STORAGE_METADATA_GRPC_PROTOCOL" desc:"The transport protocol of the grpc service."`
Prefix string
}
type Drivers struct {
EOS EOSDriver
Local LocalDriver
OCIS OCISDriver
S3 S3Driver
S3NG S3NGDriver
OwnCloudSQL OwnCloudSQLDriver
}
type EOSDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
// ShadowNamespace for storing shadow data
ShadowNamespace string `yaml:"shadow_namespace"`
// UploadsNamespace for storing upload data
UploadsNamespace string `yaml:"uploads_namespace"`
// Location of the eos binary.
// Default is /usr/bin/eos.
EosBinary string `yaml:"eos_binary"`
// Location of the xrdcopy binary.
// Default is /usr/bin/xrdcopy.
XrdcopyBinary string `yaml:"xrd_copy_binary"`
// URL of the Master EOS MGM.
// Default is root://eos-example.org
MasterURL string `yaml:"master_url"`
// URL of the Slave EOS MGM.
// Default is root://eos-example.org
SlaveURL string `yaml:"slave_url"`
// Location on the local fs where to store reads.
// Defaults to os.TempDir()
CacheDirectory string `yaml:"cache_directory"`
// SecProtocol specifies the xrootd security protocol to use between the server and EOS.
SecProtocol string `yaml:"sec_protocol"`
// Keytab specifies the location of the keytab to use to authenticate to EOS.
Keytab string `yaml:"keytab"`
// SingleUsername is the username to use when SingleUserMode is enabled
SingleUsername string `yaml:"single_username"`
// Enables logging of the commands executed
// Defaults to false
EnableLogging bool `yaml:"enable_logging"`
// ShowHiddenSysFiles shows internal EOS files like
// .sys.v# and .sys.a# files.
ShowHiddenSysFiles bool `yaml:"shadow_hidden_files"`
// ForceSingleUserMode will force connections to EOS to use SingleUsername
ForceSingleUserMode bool `yaml:"force_single_user_mode"`
// UseKeyTabAuth changes will authenticate requests by using an EOS keytab.
UseKeytab bool `yaml:"user_keytab"`
// gateway service to use for uid lookups
GatewaySVC string `yaml:"gateway_svc"`
//ShareFolder defines the name of the folder jailing all shares
ShareFolder string `yaml:"share_folder"`
GRPCURI string
UserLayout string
}
type LocalDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
//ShareFolder defines the name of the folder jailing all shares
ShareFolder string `yaml:"share_folder"`
UserLayout string
}
type OCISDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
UserLayout string
PermissionsEndpoint string
// PersonalSpaceAliasTemplate contains the template used to construct
// the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"`
PersonalSpaceAliasTemplate string `yaml:"personalspacealias_template"`
// GeneralSpaceAliasTemplate contains the template used to construct
// the general space alias, eg: `{{.SpaceType}}/{{.SpaceName | replace " " "-" | lower}}`
GeneralSpaceAliasTemplate string `yaml:"generalspacealias_template"`
//ShareFolder defines the name of the folder jailing all shares
ShareFolder string `yaml:"share_folder"`
}
type S3Driver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
Region string `yaml:"region"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
Endpoint string `yaml:"endpoint"`
Bucket string `yaml:"bucket"`
}
type S3NGDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
UserLayout string
PermissionsEndpoint string
Region string `yaml:"region"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
Endpoint string `yaml:"endpoint"`
Bucket string `yaml:"bucket"`
// PersonalSpaceAliasTemplate contains the template used to construct
// the personal space alias, eg: `"{{.SpaceType}}/{{.User.Username | lower}}"`
PersonalSpaceAliasTemplate string `yaml:"personalspacealias_template"`
// GeneralSpaceAliasTemplate contains the template used to construct
// the general space alias, eg: `{{.SpaceType}}/{{.SpaceName | replace " " "-" | lower}}`
GeneralSpaceAliasTemplate string `yaml:"generalspacealias_template"`
//ShareFolder defines the name of the folder jailing all shares
ShareFolder string `yaml:"share_folder"`
}
type OwnCloudSQLDriver struct {
// Root is the absolute path to the location of the data
Root string `yaml:"root"`
//ShareFolder defines the name of the folder jailing all shares
ShareFolder string `yaml:"share_folder"`
UserLayout string
UploadInfoDir string `yaml:"upload_info_dir"`
DBUsername string `yaml:"db_username"`
DBPassword string `yaml:"db_password"`
DBHost string `yaml:"db_host"`
DBPort int `yaml:"db_port"`
DBName string `yaml:"db_name"`
UsersProviderEndpoint string
}
type Events struct {
Addr string
ClusterID string
}
@@ -0,0 +1,125 @@
package defaults
import (
"os"
"path/filepath"
"github.com/owncloud/ocis/extensions/storage-users/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
)
func FullDefaultConfig() *config.Config {
cfg := DefaultConfig()
EnsureDefaults(cfg)
return cfg
}
func DefaultConfig() *config.Config {
return &config.Config{
Debug: config.Debug{
Addr: "127.0.0.1:9159",
Token: "",
Pprof: false,
Zpages: false,
},
GRPC: config.GRPCConfig{
Addr: "127.0.0.1:9157",
Protocol: "tcp",
},
HTTP: config.HTTPConfig{
Addr: "127.0.0.1:9158",
Protocol: "tcp",
Prefix: "data",
},
Service: config.Service{
Name: "storage-users",
},
GatewayEndpoint: "127.0.0.1:9142",
JWTSecret: "Pive-Fumkiu4",
TempFolder: filepath.Join(defaults.BaseDataPath(), "tmp", "users"),
DataServerURL: "http://localhost:9158/data",
MountID: "1284d238-aa92-42ce-bdc4-0b0000009157",
Driver: "ocis",
Drivers: config.Drivers{
EOS: config.EOSDriver{
Root: "/eos/dockertest/reva",
ShareFolder: "/Shares",
UserLayout: "{{substr 0 1 .Username}}/{{.Username}}",
ShadowNamespace: "",
UploadsNamespace: "",
EosBinary: "/usr/bin/eos",
XrdcopyBinary: "/usr/bin/xrdcopy",
MasterURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
GRPCURI: "",
SlaveURL: "root://eos-mgm1.eoscluster.cern.ch:1094",
CacheDirectory: os.TempDir(),
GatewaySVC: "127.0.0.1:9142",
},
Local: config.LocalDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "local", "users"),
ShareFolder: "/Shares",
UserLayout: "{{.Username}}",
},
OwnCloudSQL: config.OwnCloudSQLDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "owncloud"),
ShareFolder: "/Shares",
UserLayout: "{{.Username}}",
UploadInfoDir: filepath.Join(defaults.BaseDataPath(), "storage", "uploadinfo"),
DBUsername: "owncloud",
DBPassword: "owncloud",
DBHost: "",
DBPort: 3306,
DBName: "owncloud",
},
S3: config.S3Driver{
Region: "default",
},
S3NG: config.S3NGDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "users"),
ShareFolder: "/Shares",
UserLayout: "{{.Id.OpaqueId}}",
Region: "default",
PersonalSpaceAliasTemplate: "{{.SpaceType}}/{{.User.Username | lower}}",
GeneralSpaceAliasTemplate: "{{.SpaceType}}/{{.SpaceName | replace \" \" \"-\" | lower}}",
},
OCIS: config.OCISDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "users"),
ShareFolder: "/Shares",
UserLayout: "{{.Id.OpaqueId}}",
PersonalSpaceAliasTemplate: "{{.SpaceType}}/{{.User.Username | lower}}",
GeneralSpaceAliasTemplate: "{{.SpaceType}}/{{.SpaceName | replace \" \" \"-\" | lower}}",
},
},
Events: config.Events{
Addr: "127.0.0.1:9233",
ClusterID: "ocis-cluster",
},
}
}
func EnsureDefaults(cfg *config.Config) {
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
if cfg.Logging == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
cfg.Logging = &config.Logging{
Level: cfg.Commons.Log.Level,
Pretty: cfg.Commons.Log.Pretty,
Color: cfg.Commons.Log.Color,
File: cfg.Commons.Log.File,
}
} else if cfg.Logging == nil {
cfg.Logging = &config.Logging{}
}
// provide with defaults for shared tracing, since we need a valid destination address for BindEnv.
if cfg.Tracing == nil && cfg.Commons != nil && cfg.Commons.Tracing != nil {
cfg.Tracing = &config.Tracing{
Enabled: cfg.Commons.Tracing.Enabled,
Type: cfg.Commons.Tracing.Type,
Endpoint: cfg.Commons.Tracing.Endpoint,
Collector: cfg.Commons.Tracing.Collector,
}
} else if cfg.Tracing == nil {
cfg.Tracing = &config.Tracing{}
}
}
+122
View File
@@ -0,0 +1,122 @@
package config
func UserDrivers(cfg *Config) map[string]interface{} {
return map[string]interface{}{
"eos": map[string]interface{}{
"namespace": cfg.Drivers.EOS.Root,
"shadow_namespace": cfg.Drivers.EOS.ShadowNamespace,
"uploads_namespace": cfg.Drivers.EOS.UploadsNamespace,
"share_folder": cfg.Drivers.EOS.ShareFolder,
"eos_binary": cfg.Drivers.EOS.EosBinary,
"xrdcopy_binary": cfg.Drivers.EOS.XrdcopyBinary,
"master_url": cfg.Drivers.EOS.MasterURL,
"slave_url": cfg.Drivers.EOS.SlaveURL,
"cache_directory": cfg.Drivers.EOS.CacheDirectory,
"sec_protocol": cfg.Drivers.EOS.SecProtocol,
"keytab": cfg.Drivers.EOS.Keytab,
"single_username": cfg.Drivers.EOS.SingleUsername,
"enable_logging": cfg.Drivers.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Drivers.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Drivers.EOS.ForceSingleUserMode,
"use_keytab": cfg.Drivers.EOS.UseKeytab,
"gatewaysvc": cfg.Drivers.EOS.GatewaySVC,
},
"eoshome": map[string]interface{}{
"namespace": cfg.Drivers.EOS.Root,
"shadow_namespace": cfg.Drivers.EOS.ShadowNamespace,
"uploads_namespace": cfg.Drivers.EOS.UploadsNamespace,
"share_folder": cfg.Drivers.EOS.ShareFolder,
"eos_binary": cfg.Drivers.EOS.EosBinary,
"xrdcopy_binary": cfg.Drivers.EOS.XrdcopyBinary,
"master_url": cfg.Drivers.EOS.MasterURL,
"slave_url": cfg.Drivers.EOS.SlaveURL,
"cache_directory": cfg.Drivers.EOS.CacheDirectory,
"sec_protocol": cfg.Drivers.EOS.SecProtocol,
"keytab": cfg.Drivers.EOS.Keytab,
"single_username": cfg.Drivers.EOS.SingleUsername,
"user_layout": cfg.Drivers.EOS.UserLayout,
"enable_logging": cfg.Drivers.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Drivers.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Drivers.EOS.ForceSingleUserMode,
"use_keytab": cfg.Drivers.EOS.UseKeytab,
"gatewaysvc": cfg.Drivers.EOS.GatewaySVC,
},
"eosgrpc": map[string]interface{}{
"namespace": cfg.Drivers.EOS.Root,
"shadow_namespace": cfg.Drivers.EOS.ShadowNamespace,
"share_folder": cfg.Drivers.EOS.ShareFolder,
"eos_binary": cfg.Drivers.EOS.EosBinary,
"xrdcopy_binary": cfg.Drivers.EOS.XrdcopyBinary,
"master_url": cfg.Drivers.EOS.MasterURL,
"master_grpc_uri": cfg.Drivers.EOS.GRPCURI,
"slave_url": cfg.Drivers.EOS.SlaveURL,
"cache_directory": cfg.Drivers.EOS.CacheDirectory,
"sec_protocol": cfg.Drivers.EOS.SecProtocol,
"keytab": cfg.Drivers.EOS.Keytab,
"single_username": cfg.Drivers.EOS.SingleUsername,
"user_layout": cfg.Drivers.EOS.UserLayout,
"enable_logging": cfg.Drivers.EOS.EnableLogging,
"show_hidden_sys_files": cfg.Drivers.EOS.ShowHiddenSysFiles,
"force_single_user_mode": cfg.Drivers.EOS.ForceSingleUserMode,
"use_keytab": cfg.Drivers.EOS.UseKeytab,
"enable_home": false,
"gatewaysvc": cfg.Drivers.EOS.GatewaySVC,
},
"local": map[string]interface{}{
"root": cfg.Drivers.Local.Root,
"share_folder": cfg.Drivers.Local.ShareFolder,
},
"localhome": map[string]interface{}{
"root": cfg.Drivers.Local.Root,
"share_folder": cfg.Drivers.Local.ShareFolder,
"user_layout": cfg.Drivers.Local.UserLayout,
},
"owncloudsql": map[string]interface{}{
"datadirectory": cfg.Drivers.OwnCloudSQL.Root,
"upload_info_dir": cfg.Drivers.OwnCloudSQL.UploadInfoDir,
"share_folder": cfg.Drivers.OwnCloudSQL.ShareFolder,
"user_layout": cfg.Drivers.OwnCloudSQL.UserLayout,
"enable_home": false,
"dbusername": cfg.Drivers.OwnCloudSQL.DBUsername,
"dbpassword": cfg.Drivers.OwnCloudSQL.DBPassword,
"dbhost": cfg.Drivers.OwnCloudSQL.DBHost,
"dbport": cfg.Drivers.OwnCloudSQL.DBPort,
"dbname": cfg.Drivers.OwnCloudSQL.DBName,
"userprovidersvc": cfg.Drivers.OwnCloudSQL.UsersProviderEndpoint,
},
"ocis": map[string]interface{}{
"root": cfg.Drivers.OCIS.Root,
"user_layout": cfg.Drivers.OCIS.UserLayout,
"share_folder": cfg.Drivers.OCIS.ShareFolder,
"personalspacealias_template": cfg.Drivers.OCIS.PersonalSpaceAliasTemplate,
"generalspacealias_template": cfg.Drivers.OCIS.GeneralSpaceAliasTemplate,
"treetime_accounting": true,
"treesize_accounting": true,
"permissionssvc": cfg.Drivers.OCIS.PermissionsEndpoint,
},
"s3": map[string]interface{}{
"enable_home": false,
"region": cfg.Drivers.S3.Region,
"access_key": cfg.Drivers.S3.AccessKey,
"secret_key": cfg.Drivers.S3.SecretKey,
"endpoint": cfg.Drivers.S3.Endpoint,
"bucket": cfg.Drivers.S3.Bucket,
"prefix": cfg.Drivers.S3.Root,
},
"s3ng": map[string]interface{}{
"root": cfg.Drivers.S3NG.Root,
"user_layout": cfg.Drivers.S3NG.UserLayout,
"share_folder": cfg.Drivers.S3NG.ShareFolder,
"personalspacealias_template": cfg.Drivers.S3NG.PersonalSpaceAliasTemplate,
"generalspacealias_template": cfg.Drivers.S3NG.GeneralSpaceAliasTemplate,
"treetime_accounting": true,
"treesize_accounting": true,
"permissionssvc": cfg.Drivers.S3NG.PermissionsEndpoint,
"s3.region": cfg.Drivers.S3NG.Region,
"s3.access_key": cfg.Drivers.S3NG.AccessKey,
"s3.secret_key": cfg.Drivers.S3NG.SecretKey,
"s3.endpoint": cfg.Drivers.S3NG.Endpoint,
"s3.bucket": cfg.Drivers.S3NG.Bucket,
},
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ func GetCommands(cfg *config.Config) cli.Commands {
// Sharing(cfg),
// StoragePublicLink(cfg),
StorageShares(cfg),
StorageUsers(cfg),
// StorageUsers(cfg),
// StorageMetadata(cfg),
Health(cfg),
}
+2
View File
@@ -23,6 +23,7 @@ import (
sharing "github.com/owncloud/ocis/extensions/sharing/pkg/config"
storagemetadata "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config"
storagepublic "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config"
storageusers "github.com/owncloud/ocis/extensions/storage-users/pkg/config"
storage "github.com/owncloud/ocis/extensions/storage/pkg/config"
store "github.com/owncloud/ocis/extensions/store/pkg/config"
thumbnails "github.com/owncloud/ocis/extensions/thumbnails/pkg/config"
@@ -91,6 +92,7 @@ type Config struct {
Sharing *sharing.Config `yaml:"app_provider"`
StorageMetadata *storagemetadata.Config `yaml:"storage_metadata"`
StoragePublicLink *storagepublic.Config `yaml:"storage_public"`
StorageUsers *storageusers.Config `yaml:"storage_users"`
Store *store.Config `yaml:"store"`
Thumbnails *thumbnails.Config `yaml:"thumbnails"`
WebDAV *webdav.Config `yaml:"webdav"`
+2
View File
@@ -21,6 +21,7 @@ import (
sharing "github.com/owncloud/ocis/extensions/sharing/pkg/config/defaults"
storagemetadata "github.com/owncloud/ocis/extensions/storage-metadata/pkg/config/defaults"
storagepublic "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/config/defaults"
storageusers "github.com/owncloud/ocis/extensions/storage-users/pkg/config/defaults"
storage "github.com/owncloud/ocis/extensions/storage/pkg/config/defaults"
store "github.com/owncloud/ocis/extensions/store/pkg/config/defaults"
thumbnails "github.com/owncloud/ocis/extensions/thumbnails/pkg/config/defaults"
@@ -63,6 +64,7 @@ func DefaultConfig() *Config {
Sharing: sharing.FullDefaultConfig(),
StorageMetadata: storagemetadata.FullDefaultConfig(),
StoragePublicLink: storagepublic.FullDefaultConfig(),
StorageUsers: storageusers.FullDefaultConfig(),
AppProvider: appprovider.FullDefaultConfig(),
}
}
+5 -5
View File
@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/extensions/storage/pkg/command"
"github.com/owncloud/ocis/extensions/storage-users/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
@@ -14,11 +14,11 @@ func StorageUsersCommand(cfg *config.Config) *cli.Command {
Usage: "start storage and data provider for /users mount",
Category: "extensions",
//Flags: flagset.StorageUsersWithConfig(cfg.Storage),
Before: func(ctx *cli.Context) error {
return ParseStorageCommon(ctx, cfg)
},
// Before: func(ctx *cli.Context) error {
// return ParseStorageCommon(ctx, cfg)
// },
Action: func(c *cli.Context) error {
origCmd := command.StorageUsers(cfg.Storage)
origCmd := command.StorageUsers(cfg.StorageUsers)
return handleOriginalAction(c, origCmd)
},
}
+2 -1
View File
@@ -38,6 +38,7 @@ import (
sharing "github.com/owncloud/ocis/extensions/sharing/pkg/command"
storagemetadata "github.com/owncloud/ocis/extensions/storage-metadata/pkg/command"
storagepublic "github.com/owncloud/ocis/extensions/storage-publiclink/pkg/command"
storageusers "github.com/owncloud/ocis/extensions/storage-users/pkg/command"
storage "github.com/owncloud/ocis/extensions/storage/pkg/command"
store "github.com/owncloud/ocis/extensions/store/pkg/command"
thumbnails "github.com/owncloud/ocis/extensions/thumbnails/pkg/command"
@@ -123,7 +124,7 @@ func NewService(options ...Option) (*Service, error) {
s.ServicesRegistry["storage-authbasic"] = authbasic.NewAuthBasic
s.ServicesRegistry["storage-authbearer"] = authbearer.NewAuthBearer
s.ServicesRegistry["storage-authmachine"] = authmachine.NewAuthMachine
s.ServicesRegistry["storage-users"] = storage.NewStorageUsers
s.ServicesRegistry["storage-users"] = storageusers.NewStorageUsers
s.ServicesRegistry["storage-shares"] = storage.NewStorageShares
s.ServicesRegistry["storage-public-link"] = storagepublic.NewStoragePublicLink
s.ServicesRegistry["storage-appprovider"] = appprovider.NewAppProvider