Integrate the s3ng storage driver
This commit is contained in:
@@ -101,5 +101,15 @@ func drivers(cfg *config.Config) map[string]interface{} {
|
||||
"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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ func StorageHome(cfg *config.Config) *cli.Command {
|
||||
cfg.Reva.Storages.Local.EnableHome = true
|
||||
cfg.Reva.Storages.OwnCloud.EnableHome = true
|
||||
cfg.Reva.Storages.S3.EnableHome = true
|
||||
cfg.Reva.Storages.S3NG.EnableHome = true
|
||||
}
|
||||
rcfg := storageHomeConfigFromStruct(c, cfg)
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ func StorageUsers(cfg *config.Config) *cli.Command {
|
||||
cfg.Reva.Storages.Local.EnableHome = true
|
||||
cfg.Reva.Storages.OwnCloud.EnableHome = true
|
||||
cfg.Reva.Storages.S3.EnableHome = true
|
||||
cfg.Reva.Storages.S3NG.EnableHome = true
|
||||
}
|
||||
rcfg := storageUsersConfigFromStruct(c, cfg)
|
||||
|
||||
|
||||
@@ -164,6 +164,7 @@ type StorageConfig struct {
|
||||
Local DriverCommon
|
||||
OwnCloud DriverOwnCloud
|
||||
S3 DriverS3
|
||||
S3NG DriverS3NG
|
||||
Common DriverCommon
|
||||
OCIS DriverOCIS
|
||||
// TODO checksums ... figure out what that is supposed to do
|
||||
@@ -268,6 +269,17 @@ type DriverS3 struct {
|
||||
Bucket string
|
||||
}
|
||||
|
||||
// DriverS3NG defines the available s3ng storage driver configuration.
|
||||
type DriverS3NG struct {
|
||||
DriverCommon
|
||||
|
||||
Region string
|
||||
AccessKey string
|
||||
SecretKey string
|
||||
Endpoint string
|
||||
Bucket string
|
||||
}
|
||||
|
||||
// OIDC defines the available OpenID Connect configuration.
|
||||
type OIDC struct {
|
||||
Issuer string
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
"github.com/owncloud/ocis/storage/pkg/config"
|
||||
)
|
||||
|
||||
// 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.Storages.Common.Root, "/var/tmp/ocis/storage/users"),
|
||||
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,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-s3ng-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_S3NG_LAYOUT"},
|
||||
Destination: &cfg.Reva.Storages.Common.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,
|
||||
},
|
||||
&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,
|
||||
},
|
||||
&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,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage-s3ng-endpoint",
|
||||
Value: "",
|
||||
Usage: `"s3 compatible API endpoint" `,
|
||||
EnvVars: []string{"STORAGE_DRIVER_S3NG_ENDPOINT"},
|
||||
Destination: &cfg.Reva.Storages.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,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -156,6 +156,7 @@ func StorageHomeWithConfig(cfg *config.Config) []cli.Flag {
|
||||
flags = append(flags, DriverLocalWithConfig(cfg)...)
|
||||
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
|
||||
flags = append(flags, DriverOCISWithConfig(cfg)...)
|
||||
flags = append(flags, DriverS3NGWithConfig(cfg)...)
|
||||
|
||||
return flags
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ func StorageUsersWithConfig(cfg *config.Config) []cli.Flag {
|
||||
flags = append(flags, DriverLocalWithConfig(cfg)...)
|
||||
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
|
||||
flags = append(flags, DriverOCISWithConfig(cfg)...)
|
||||
flags = append(flags, DriverS3NGWithConfig(cfg)...)
|
||||
|
||||
return flags
|
||||
}
|
||||
|
||||
@@ -111,3 +111,7 @@ Example: Set the home and users Storage Provider to `ocis`
|
||||
### Ocis Driver
|
||||
|
||||
{{ template "option" (list .Options "DriverOCISWithConfig") -}}
|
||||
|
||||
### S3ng Driver
|
||||
|
||||
{{ template "option" (list .Options "DriverS3NGWithConfig") -}}
|
||||
|
||||
Reference in New Issue
Block a user