From 74ca24d3ff02597f941e8ef013afe4817958a5b0 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 6 Jun 2023 12:08:33 +0200 Subject: [PATCH] feat: add uppy companion url config --- changelog/unreleased/enhancement-add-companion-url-config.md | 5 +++++ services/web/pkg/config/defaults/defaultconfig.go | 2 +- services/web/pkg/config/options.go | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/enhancement-add-companion-url-config.md diff --git a/changelog/unreleased/enhancement-add-companion-url-config.md b/changelog/unreleased/enhancement-add-companion-url-config.md new file mode 100644 index 0000000000..1ea52cc9e0 --- /dev/null +++ b/changelog/unreleased/enhancement-add-companion-url-config.md @@ -0,0 +1,5 @@ +Enhancement: Add companion URL config + +Introduce a config to set the Uppy Companion URL via `WEB_OPTION_UPLOAD_COMPANION_URL`. + +https://github.com/owncloud/ocis/pull/6453 diff --git a/services/web/pkg/config/defaults/defaultconfig.go b/services/web/pkg/config/defaults/defaultconfig.go index c2acd8f03a..b24440867a 100644 --- a/services/web/pkg/config/defaults/defaultconfig.go +++ b/services/web/pkg/config/defaults/defaultconfig.go @@ -194,7 +194,7 @@ func Sanitize(cfg *config.Config) { cfg.Web.Config.Options.FeedbackLink = nil } // remove Upload parent if no value is set - if cfg.Web.Config.Options.Upload.XHR.Timeout == 0 { + if cfg.Web.Config.Options.Upload.XHR.Timeout == 0 && cfg.Web.Config.Options.Upload.CompanionURL == "" { cfg.Web.Config.Options.Upload = nil } } diff --git a/services/web/pkg/config/options.go b/services/web/pkg/config/options.go index 2ea9696391..aefb566d14 100644 --- a/services/web/pkg/config/options.go +++ b/services/web/pkg/config/options.go @@ -51,7 +51,8 @@ type Routing struct { // Upload are the upload options type Upload struct { - XHR XHR `json:"xhr,omitempty" yaml:"xhr"` + XHR XHR `json:"xhr,omitempty" yaml:"xhr"` + CompanionURL string `json:"companionUrl,omitempty" yaml:"companionUrl" env:"WEB_OPTION_UPLOAD_COMPANION_URL" desc:"Sets the URL of Companion which is a service provided by Uppy to import files from external cloud providers. See https://uppy.io/docs/companion/ for instructions on how to set up Companion. This feature is disabled as long as no URL is given."` } // XHR are the XHR options