Create onlyoffice extension
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis/ocis/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/onlyoffice/pkg/command"
|
||||
"github.com/owncloud/ocis/onlyoffice/pkg/flagset"
|
||||
)
|
||||
|
||||
// OnlyofficeCommand is the entrypoint for the onlyoffice command.
|
||||
func OnlyofficeCommand(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "onlyoffice",
|
||||
Usage: "Start onlyoffice server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Onlyoffice),
|
||||
Before: func(c *cli.Context) error {
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
onlyofficeCommand := command.Server(configureOnlyoffice(cfg).Onlyoffice)
|
||||
|
||||
if err := onlyofficeCommand.Before(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return cli.HandleAction(onlyofficeCommand.Action, c)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureOnlyoffice(cfg *config.Config) *config.Config {
|
||||
cfg.Onlyoffice.Log.Level = cfg.Log.Level
|
||||
cfg.Onlyoffice.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Onlyoffice.Log.Color = cfg.Log.Color
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
cfg.Onlyoffice.Tracing.Enabled = cfg.Tracing.Enabled
|
||||
cfg.Onlyoffice.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Onlyoffice.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Onlyoffice.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(OnlyofficeCommand)
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
konnectd "github.com/owncloud/ocis/konnectd/pkg/config"
|
||||
phoenix "github.com/owncloud/ocis/ocis-phoenix/pkg/config"
|
||||
ocs "github.com/owncloud/ocis/ocs/pkg/config"
|
||||
onlyoffice "github.com/owncloud/ocis/onlyoffice/pkg/config"
|
||||
proxy "github.com/owncloud/ocis/proxy/pkg/config"
|
||||
settings "github.com/owncloud/ocis/settings/pkg/config"
|
||||
storage "github.com/owncloud/ocis/storage/pkg/config"
|
||||
@@ -70,19 +71,20 @@ type Config struct {
|
||||
TokenManager TokenManager
|
||||
|
||||
Accounts *accounts.Config
|
||||
GLAuth *glauth.Config
|
||||
Graph *graph.Config
|
||||
GraphExplorer *graphExplorer.Config
|
||||
GLAuth *glauth.Config
|
||||
Hello *hello.Config
|
||||
Konnectd *konnectd.Config
|
||||
OCS *ocs.Config
|
||||
Onlyoffice *onlyoffice.Config
|
||||
Phoenix *phoenix.Config
|
||||
Proxy *proxy.Config
|
||||
Settings *settings.Config
|
||||
Storage *storage.Config
|
||||
Store *store.Config
|
||||
Thumbnails *thumbnails.Config
|
||||
WebDAV *webdav.Config
|
||||
Settings *settings.Config
|
||||
Store *store.Config
|
||||
Runtime *pman.Config
|
||||
}
|
||||
|
||||
@@ -90,19 +92,20 @@ type Config struct {
|
||||
func New() *Config {
|
||||
return &Config{
|
||||
Accounts: accounts.New(),
|
||||
GLAuth: glauth.New(),
|
||||
Graph: graph.New(),
|
||||
GraphExplorer: graphExplorer.New(),
|
||||
Hello: hello.New(),
|
||||
Konnectd: konnectd.New(),
|
||||
OCS: ocs.New(),
|
||||
Onlyoffice: onlyoffice.New(),
|
||||
Phoenix: phoenix.New(),
|
||||
WebDAV: webdav.New(),
|
||||
Storage: storage.New(),
|
||||
GLAuth: glauth.New(),
|
||||
Proxy: proxy.New(),
|
||||
Thumbnails: thumbnails.New(),
|
||||
Settings: settings.New(),
|
||||
Storage: storage.New(),
|
||||
Store: store.New(),
|
||||
Thumbnails: thumbnails.New(),
|
||||
WebDAV: webdav.New(),
|
||||
Runtime: pman.NewConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,14 +33,16 @@ var (
|
||||
|
||||
// Extensions are ocis extension services
|
||||
Extensions = []string{
|
||||
"proxy",
|
||||
"store",
|
||||
"settings",
|
||||
"phoenix",
|
||||
"glauth",
|
||||
"graph",
|
||||
"graph-explorer",
|
||||
"konnectd",
|
||||
"ocs",
|
||||
"webdav",
|
||||
"onlyoffice",
|
||||
"phoenix",
|
||||
"proxy",
|
||||
"settings",
|
||||
"store",
|
||||
"storage-frontend",
|
||||
"storage-gateway",
|
||||
"storage-userprovider",
|
||||
@@ -50,9 +52,8 @@ var (
|
||||
"storage-users",
|
||||
"storage-metadata",
|
||||
"storage-public-link",
|
||||
"glauth",
|
||||
"konnectd",
|
||||
"thumbnails",
|
||||
"webdav",
|
||||
}
|
||||
|
||||
// There seem to be a race condition when reva-sharing needs to read the sharing.json file and the parent folder is not present.
|
||||
|
||||
Reference in New Issue
Block a user