add documentation, wire configuration
This commit is contained in:
@@ -48,7 +48,10 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
||||
|
||||
rcfg := revaconfig.FrontendConfigFromStruct(cfg)
|
||||
rcfg, err := revaconfig.FrontendConfigFromStruct(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
gr.Add(func() error {
|
||||
runtime.RunWithOptions(rcfg, pidFile, runtime.WithLogger(&logger.Logger))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package revaconfig
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
@@ -9,7 +10,15 @@ import (
|
||||
)
|
||||
|
||||
// FrontendConfigFromStruct will adapt an oCIS config struct into a reva mapstructure to start a reva service.
|
||||
func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
func FrontendConfigFromStruct(cfg *config.Config) (map[string]interface{}, error) {
|
||||
|
||||
webURL, err := url.Parse(cfg.PublicURL)
|
||||
if err != nil {
|
||||
return map[string]interface{}{}, err
|
||||
}
|
||||
webURL.Path = "/external"
|
||||
webOpenInAppURL := webURL.String()
|
||||
|
||||
archivers := []map[string]interface{}{
|
||||
{
|
||||
"enabled": true,
|
||||
@@ -27,7 +36,7 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"version": "1.1.0",
|
||||
"apps_url": "/app/list",
|
||||
"open_url": "/app/open",
|
||||
"open_web_url": "/app/open-in-web",
|
||||
"open_web_url": "/app/open-with-web",
|
||||
"new_url": "/app/new",
|
||||
},
|
||||
}
|
||||
@@ -89,15 +98,16 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"transfer_shared_secret": cfg.TransferSecret,
|
||||
"timeout": 86400,
|
||||
"insecure": cfg.AppHandler.Insecure,
|
||||
"webbaseuri": "https://ocis.owncloud.test/external",
|
||||
"webbaseuri": webOpenInAppURL,
|
||||
"web": map[string]interface{}{
|
||||
"urlparamsmapping": map[string]string{
|
||||
// param -> value mapper
|
||||
// these mappers are static and are only subject to change when changed in oC Web
|
||||
"fileId": "fileid",
|
||||
"app": "appname",
|
||||
},
|
||||
"staticurlparams": map[string]string{
|
||||
"contextRouteName": "files-spaces-personal",
|
||||
"contextRouteName": "files-spaces-personal", // TODO: remove when https://github.com/owncloud/web/pull/7437 arrived in oCIS
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -239,5 +249,5 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user