Skip to content

Commit

Permalink
fix(ocm): add data_server_url to ocm storage provider
Browse files Browse the repository at this point in the history
Fixes: #10358
  • Loading branch information
rhafer committed Oct 29, 2024
1 parent 7d492b5 commit 1bb3119
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
10 changes: 10 additions & 0 deletions changelog/unreleased/fix-ocm-data-server-url.md
Original file line number Diff line number Diff line change
@@ -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

5 changes: 3 additions & 2 deletions services/ocm/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions services/ocm/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion services/ocm/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1bb3119

Please sign in to comment.