diff --git a/changelog/unreleased/fix-ocm-data-server-url.md b/changelog/unreleased/fix-ocm-data-server-url.md new file mode 100644 index 00000000000..668d6b648eb --- /dev/null +++ b/changelog/unreleased/fix-ocm-data-server-url.md @@ -0,0 +1,10 @@ +Bugfix: Allow to configure data server URL for ocm + +We introduced the `OCM_OCM_STORAGE_DATA_SERVER_URL` setting to fix a bug +when downloading files from an OCM share. Before the data server URL defaulted +to the listen address of the OCM server, which did not work when using +0.0.0.0 as the listen address. + +https://github.com/owncloud/ocis/pull/10440 +https://github.com/owncloud/ocis/issues/10358 + diff --git a/services/ocm/pkg/config/config.go b/services/ocm/pkg/config/config.go index 75c292d9126..c961c1aebbd 100644 --- a/services/ocm/pkg/config/config.go +++ b/services/ocm/pkg/config/config.go @@ -121,8 +121,9 @@ type OCMCore struct { Drivers OCMCoreDrivers `yaml:"drivers"` } type OCMStorageProvider struct { - Insecure bool `yaml:"insecure" env:"OCM_OCM_STORAGE_PROVIDER_INSECURE" desc:"Disable TLS certificate validation for the OCM connections. Do not set this in production environments." introductionVersion:"5.0"` - StorageRoot string `yaml:"storage_root" env:"OCM_OCM_STORAGE_PROVIDER_STORAGE_ROOT" desc:"Directory where the ocm storage provider persists its data like tus upload info files." introductionVersion:"5.0"` + Insecure bool `yaml:"insecure" env:"OCM_OCM_STORAGE_PROVIDER_INSECURE" desc:"Disable TLS certificate validation for the OCM connections. Do not set this in production environments." introductionVersion:"5.0"` + StorageRoot string `yaml:"storage_root" env:"OCM_OCM_STORAGE_PROVIDER_STORAGE_ROOT" desc:"Directory where the ocm storage provider persists its data like tus upload info files." introductionVersion:"5.0"` + DataServerURL string `yaml:"data_server_url" env:"OCM_OCM_STORAGE_DATA_SERVER_URL" desc:"URL of the data server, needs to be reachable by the data gateway provided by the frontend service or the user if directly exposed." introductionVersion:"7.0.0"` } type OCMCoreDrivers struct { diff --git a/services/ocm/pkg/config/defaults/defaultconfig.go b/services/ocm/pkg/config/defaults/defaultconfig.go index 1b4cdae30c5..aab7f2f2a60 100644 --- a/services/ocm/pkg/config/defaults/defaultconfig.go +++ b/services/ocm/pkg/config/defaults/defaultconfig.go @@ -130,8 +130,9 @@ func DefaultConfig() *config.Config { }, }, OCMStorageProvider: config.OCMStorageProvider{ - Insecure: false, - StorageRoot: filepath.Join(defaults.BaseDataPath(), "storage", "ocm"), + Insecure: false, + StorageRoot: filepath.Join(defaults.BaseDataPath(), "storage", "ocm"), + DataServerURL: "http://localhost:9280/data", }, } } diff --git a/services/ocm/pkg/revaconfig/config.go b/services/ocm/pkg/revaconfig/config.go index 3285822c17b..601cfc3bb81 100644 --- a/services/ocm/pkg/revaconfig/config.go +++ b/services/ocm/pkg/revaconfig/config.go @@ -163,7 +163,7 @@ func OCMConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]inter "storage_root": cfg.OCMStorageProvider.StorageRoot, }, }, - "data_server_url": "http://" + cfg.HTTP.Addr + "/data", + "data_server_url": cfg.OCMStorageProvider.DataServerURL, }, "authprovider": map[string]interface{}{ "auth_manager": "ocmshares",