ocis icon indicating copy to clipboard operation
ocis copied to clipboard

make storage users service name configurable

Open butonic opened this issue 1 year ago • 2 comments

Currently, there is no way to start an additional storage provider with a custom configuration, eg. to test a new storage driver like hellofs

With this change I can run hellofs by setting a few env vars and then running ocis storage-users server:

	"STORAGE_USERS_SERVICE_NAME":"storage-hello",
	"STORAGE_USERS_DRIVER": "hello",
	"STORAGE_USERS_HTTP_ADDR":"127.0.0.1:9301",
	"STORAGE_USERS_DEBUG_ADDR":"127.0.0.1:9302",
	"STORAGE_USERS_GRPC_ADDR":"127.0.0.1:9303",
	"STORAGE_USERS_DATA_SERVER_URL":"http://127.0.0.1:9301/data",

Furthermore, it is really cumbersome to add an additional storage driver to the storage registry in the gateway. Quickest for development is this diff:

diff --git a/services/gateway/pkg/revaconfig/config.go b/services/gateway/pkg/revaconfig/config.go
index c13688aee9..7c5d992b42 100644
--- a/services/gateway/pkg/revaconfig/config.go
+++ b/services/gateway/pkg/revaconfig/config.go
@@ -203,6 +203,15 @@ func spacesProviders(cfg *config.Config, logger log.Logger) map[string]map[strin
                                },
                        },
                },
+               "com.owncloud.api.storage-hello": {
+                       "providerid": "hello-storage-id",
+                       "spaces": map[string]interface{}{
+                               "project": map[string]interface{}{
+                                       "mount_point":   "/hello",
+                                       "path_template": "/hello/{{.Space.Name}}",
+                               },
+                       },
+               },
                // medatada storage not part of the global namespace
        }
 }

What is missing to be able to run a fully custom storage driver is a way to pass configuration to it. since we cannot forsee the cconfig options this will have to be a generic mapping from a yaml file to the reva config.

butonic avatar Jan 25 '24 15:01 butonic

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

update-docs[bot] avatar Jan 25 '24 15:01 update-docs[bot]

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 26 '24 09:01 sonarqubecloud[bot]