Skip to content

Commit

Permalink
[WIP] Add support for the oc 10 sql share manager
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jul 23, 2021
1 parent 1a8c560 commit 33beee7
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
12 changes: 6 additions & 6 deletions storage/pkg/command/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ func rules(cfg *config.Config, logger log.Logger) map[string]map[string]interfac

// generate rules based on default config
return map[string]map[string]interface{}{
cfg.Reva.StorageShares.MountPath: {"address": cfg.Reva.StorageShares.Endpoint},
cfg.Reva.StorageHome.MountPath: {"address": cfg.Reva.StorageHome.Endpoint},
cfg.Reva.StorageHome.MountID: {"address": cfg.Reva.StorageHome.Endpoint},
cfg.Reva.StorageUsers.MountPath: {"address": cfg.Reva.StorageUsers.Endpoint},
cfg.Reva.StorageUsers.MountID + ".*": {"address": cfg.Reva.StorageUsers.Endpoint},
cfg.Reva.StoragePublicLink.MountPath: {"address": cfg.Reva.StoragePublicLink.Endpoint},
cfg.Reva.StorageShares.MountPath: {"address": cfg.Reva.StorageShares.Endpoint},
cfg.Reva.StorageHome.MountPath: {"address": cfg.Reva.StorageHome.Endpoint},
cfg.Reva.StorageHome.MountID: {"address": cfg.Reva.StorageHome.Endpoint},
cfg.Reva.StorageUsers.MountPath: {"address": cfg.Reva.StorageUsers.Endpoint},
cfg.Reva.StorageUsers.MountID + "\\!?.*": {"address": cfg.Reva.StorageUsers.Endpoint},
cfg.Reva.StoragePublicLink.MountPath: {"address": cfg.Reva.StoragePublicLink.Endpoint},
// public link storage returns the mount id of the actual storage
// medatada storage not part of the global namespace
}
Expand Down
2 changes: 2 additions & 0 deletions storage/pkg/command/sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ func sharingConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]inte
"file": cfg.Reva.Sharing.UserJSONFile,
},
"sql": map[string]interface{}{
"gateway_addr": cfg.Reva.Gateway.Endpoint,
"storage_mount_id": cfg.Reva.Sharing.UserStorageMountId,
"db_username": cfg.Reva.Sharing.UserSQLUsername,
"db_password": cfg.Reva.Sharing.UserSQLPassword,
"db_host": cfg.Reva.Sharing.UserSQLHost,
Expand Down
2 changes: 2 additions & 0 deletions storage/pkg/command/storageshares.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func storageSharesConfigFromStruct(c *cli.Context, cfg *config.Config) map[strin
"file": cfg.Reva.Sharing.UserJSONFile,
},
"sql": map[string]interface{}{
"gateway_addr": cfg.Reva.Gateway.Endpoint,
"storage_mount_id": cfg.Reva.Sharing.UserStorageMountId,
"db_username": cfg.Reva.Sharing.UserSQLUsername,
"db_password": cfg.Reva.Sharing.UserSQLPassword,
"db_host": cfg.Reva.Sharing.UserSQLHost,
Expand Down
1 change: 1 addition & 0 deletions storage/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Sharing struct {
Port
UserDriver string
UserJSONFile string
UserStorageMountId string
UserSQLUsername string
UserSQLPassword string
UserSQLHost string
Expand Down
7 changes: 7 additions & 0 deletions storage/pkg/flagset/sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ func SharingWithConfig(cfg *config.Config) []cli.Flag {
Usage: "--service usershareprovider [--service publicshareprovider]",
EnvVars: []string{"STORAGE_SHARING_SERVICES"},
},
&cli.StringFlag{
Name: "gateway-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Gateway.Endpoint, "localhost:9142"),
Usage: "endpoint to use for the storage gateway service",
EnvVars: []string{"STORAGE_GATEWAY_ENDPOINT"},
Destination: &cfg.Reva.Gateway.Endpoint,
},
&cli.StringFlag{
Name: "user-driver",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserDriver, "json"),
Expand Down
7 changes: 7 additions & 0 deletions storage/pkg/flagset/sharingsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import (
// SharingSQLWithConfig applies the Shring SQL driver cfg to the flagset
func SharingSQLWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "storage-mount-id",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserStorageMountId, "1284d238-aa92-42ce-bdc4-0b0000009157"),
Usage: "mount id of the storage that is used for accessing the shares",
EnvVars: []string{"STORAGE_SHARING_USER_STORAGE_MOUNT_ID"},
Destination: &cfg.Reva.Sharing.UserStorageMountId,
},
&cli.StringFlag{
Name: "user-sql-username",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserSQLUsername, ""),
Expand Down
8 changes: 8 additions & 0 deletions storage/pkg/flagset/storageshares.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func StorageShares(cfg *config.Config) []cli.Flag {
Destination: &cfg.Reva.Gateway.Endpoint,
},

&cli.StringFlag{
Name: "storage-mount-id",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserStorageMountId, "1284d238-aa92-42ce-bdc4-0b0000009157"),
Usage: "mount id of the storage that is used for accessing the shares",
EnvVars: []string{"STORAGE_SHARING_USER_STORAGE_MOUNT_ID"},
Destination: &cfg.Reva.Sharing.UserStorageMountId,
},

&cli.StringFlag{
Name: "user-driver",
Value: flags.OverrideDefaultString(cfg.Reva.Sharing.UserDriver, "json"),
Expand Down

0 comments on commit 33beee7

Please sign in to comment.