Skip to content

Commit

Permalink
Make root OCM URLs configurable in /ocm-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed May 10, 2023
1 parent 5844697 commit e2d2dd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/http/services/ocmd/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ func (h *discoHandler) init(c *config) {
h.d.Provider = c.Provider
rtProtos := map[string]string{}
// webdav is always enabled
rtProtos["webdav"] = fmt.Sprintf("%s/remote.php/dav/%s", c.Endpoint, c.Prefix)
rtProtos["webdav"] = fmt.Sprintf("%s/%s/%s", c.Endpoint, c.WebDAVRoot, c.Prefix)
if c.EnableWebApp {
rtProtos["webapp"] = fmt.Sprintf("%s/external/sciencemesh", c.Endpoint)
rtProtos["webapp"] = fmt.Sprintf("%s/%s", c.Endpoint, c.WebAppRoot)
}
if c.EnableDataTx {
rtProtos["datatx"] = fmt.Sprintf("%s/remote.php/dav/%s", c.Endpoint, c.Prefix)
rtProtos["datatx"] = fmt.Sprintf("%s/%s/%s", c.Endpoint, c.WebDAVRoot, c.Prefix)
}
h.d.ResourceTypes = []resourceTypes{{
Name: "file", // so far we only support `file`
Expand Down
8 changes: 8 additions & 0 deletions internal/http/services/ocmd/ocm.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type config struct {
GatewaySvc string `mapstructure:"gatewaysvc"`
Endpoint string `mapstructure:"endpoint"`
Provider string `mapstructure:"provider"`
WebDAVRoot string `mapstructure:"webdav_root"`
WebAppRoot string `mapstructure:"webapp_root"`
EnableWebApp bool `mapstructure:"enable_webapp"`
EnableDataTx bool `mapstructure:"enable_datatx"`
ExposeRecipientDisplayName bool `mapstructure:"expose_recipient_display_name"`
Expand All @@ -55,6 +57,12 @@ func (c *config) init() {
if c.Provider == "" {
c.Provider = "reva"
}
if c.WebDAVRoot == "" {
c.WebDAVRoot = "remote.php/dav"
}
if c.WebAppRoot == "" {
c.WebAppRoot = "external/sciencemesh"
}
}

type svc struct {
Expand Down

0 comments on commit e2d2dd8

Please sign in to comment.