From 8bc8f4651f855a0c3093378add694116c6834f91 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 23 Sep 2021 11:35:44 +0200 Subject: [PATCH] make urls configurable Co-authored-by: Pascal Wengerter --- go.sum | 2 -- storage/pkg/command/frontend.go | 10 +++++----- storage/pkg/config/config.go | 3 +++ storage/pkg/flagset/frontend.go | 26 +++++++++++++++++++++----- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/go.sum b/go.sum index 8e036eea367..38bafe5cead 100644 --- a/go.sum +++ b/go.sum @@ -291,8 +291,6 @@ github.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4= github.com/cs3org/go-cs3apis v0.0.0-20210916072651-dd30db9dbe58 h1:BxySl8qrPon7Yd98Ly8y45esk1zKaddnatKSgeoblXY= github.com/cs3org/go-cs3apis v0.0.0-20210916072651-dd30db9dbe58/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva v1.13.1-0.20210921133241-ce466cb89fdc h1:AS7xNqqxpsrg+xbTQU1GxBl0Tquiq7zH96iISsiXVVU= -github.com/cs3org/reva v1.13.1-0.20210921133241-ce466cb89fdc/go.mod h1:FQw3Asg4VbzthnQPRELjJPxGCSwvMq9FOWjJ1/r1ImU= github.com/cs3org/reva v1.13.1-0.20210923072026-e96fa872a8f5 h1:qpmh61BjoH5GRg+XtLSW3J58QDa2sk58Ul9NXCAnqKE= github.com/cs3org/reva v1.13.1-0.20210923072026-e96fa872a8f5/go.mod h1:FQw3Asg4VbzthnQPRELjJPxGCSwvMq9FOWjJ1/r1ImU= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= diff --git a/storage/pkg/command/frontend.go b/storage/pkg/command/frontend.go index 40289cdf03d..aee78077417 100644 --- a/storage/pkg/command/frontend.go +++ b/storage/pkg/command/frontend.go @@ -59,16 +59,16 @@ func Frontend(cfg *config.Config) *cli.Command { "enabled": true, "version": "2.0.0", "formats": []string{"tar", "zip"}, - "archiver_url": "/archiver", + "archiver_url": cfg.Reva.Archiver.ArchiverURL, }, } - appproviders := []map[string]interface{}{ + appProviders := []map[string]interface{}{ { "enabled": true, "version": "1.0.0", - "apps_url": "/app/list", - "open_url": "/app/open", + "apps_url": cfg.Reva.AppProvider.AppsURL, + "open_url": cfg.Reva.AppProvider.OpenURL, }, } @@ -79,7 +79,7 @@ func Frontend(cfg *config.Config) *cli.Command { "undelete": true, "versioning": true, "archivers": archivers, - "app_providers": appproviders, + "app_providers": appProviders, } if cfg.Reva.DefaultUploadProtocol == "tus" { diff --git a/storage/pkg/config/config.go b/storage/pkg/config/config.go index 4b374a292bc..5d377820fac 100644 --- a/storage/pkg/config/config.go +++ b/storage/pkg/config/config.go @@ -45,6 +45,8 @@ type AppProvider struct { ExternalAddr string Driver string WopiDriver WopiDriver + AppsURL string + OpenURL string } type WopiDriver struct { @@ -415,6 +417,7 @@ type OCDav struct { type Archiver struct { MaxNumFiles int64 MaxSize int64 + ArchiverURL string } // Reva defines the available reva configuration. diff --git a/storage/pkg/flagset/frontend.go b/storage/pkg/flagset/frontend.go index dda6af8a5fb..1431dd9b209 100644 --- a/storage/pkg/flagset/frontend.go +++ b/storage/pkg/flagset/frontend.go @@ -219,11 +219,27 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag { // Archiver &cli.StringFlag{ - Name: "default-upload-protocol", - Value: flags.OverrideDefaultString(cfg.Reva.DefaultUploadProtocol, "tus"), - Usage: "Default upload chunking protocol to be used out of tus/v1/ng", - EnvVars: []string{"STORAGE_FRONTEND_DEFAULT_UPLOAD_PROTOCOL"}, - Destination: &cfg.Reva.Archiver., + Name: "archiver-url", + Value: flags.OverrideDefaultString(cfg.Reva.Archiver.ArchiverURL, "/archiver"), + Usage: "URL where the archiver is reachable", + EnvVars: []string{"STORAGE_FRONTEND_ARCHIVER_URL"}, + Destination: &cfg.Reva.Archiver.ArchiverURL, + }, + + // App Provider + &cli.StringFlag{ + Name: "appprovider-apps-url", + Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.AppsURL, "/app/list"), + Usage: "URL where the archiver is reachable", + EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_APPS_URL"}, + Destination: &cfg.Reva.AppProvider.AppsURL, + }, + &cli.StringFlag{ + Name: "appprovider-open-url", + Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.OpenURL, "/app/open"), + Usage: "URL where the archiver is reachable", + EnvVars: []string{"STORAGE_FRONTEND_APP_PROVIDER_OPEN_URL"}, + Destination: &cfg.Reva.AppProvider.OpenURL, }, // Reva Middlewares Config