Files
ocis/pkg/command/webdav.go
T

43 lines
1.0 KiB
Go
Raw Normal View History

2020-01-09 14:33:44 +01:00
// +build !simple
2019-09-05 12:06:03 +02:00
package command
import (
2020-02-10 17:04:40 +01:00
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-webdav/pkg/command"
svcconfig "github.com/owncloud/ocis-webdav/pkg/config"
"github.com/owncloud/ocis-webdav/pkg/flagset"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/register"
2019-09-05 12:06:03 +02:00
)
// WebDAVCommand is the entrypoint for the webdav command.
2020-02-10 17:04:40 +01:00
func WebDAVCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "webdav",
Usage: "Start webdav server",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.WebDAV),
Action: func(c *cli.Context) error {
2020-03-17 15:01:09 +01:00
webdavCommand := command.Server(configureWebDAV(cfg))
2020-03-17 15:01:09 +01:00
if err := webdavCommand.Before(c); err != nil {
return err
}
return cli.HandleAction(webdavCommand.Action, c)
},
}
}
func configureWebDAV(cfg *config.Config) *svcconfig.Config {
cfg.WebDAV.Log.Level = cfg.Log.Level
cfg.WebDAV.Log.Pretty = cfg.Log.Pretty
cfg.WebDAV.Log.Color = cfg.Log.Color
return cfg.WebDAV
}
2019-09-05 12:06:03 +02:00
func init() {
register.AddCommand(WebDAVCommand)
}