remove handlers

This commit is contained in:
A.Unger
2019-12-17 15:02:25 +01:00
parent 845e6da40f
commit c17568a319
6 changed files with 0 additions and 288 deletions
-43
View File
@@ -1,15 +1,10 @@
package command
import (
"context"
"github.com/micro/cli"
"github.com/oklog/run"
"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-webdav/pkg/metrics"
"github.com/owncloud/ocis-webdav/pkg/server/http"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/register"
)
@@ -32,43 +27,6 @@ func WebDAVCommand(cfg *config.Config) cli.Command {
}
}
// WebDAVHandler defines the direct server handler.
func WebDAVHandler(ctx context.Context, cancel context.CancelFunc, gr *run.Group, cfg *config.Config) error {
scfg := configureWebDAV(cfg)
logger := command.NewLogger(scfg)
m := metrics.New()
{
server, err := http.Server(
http.Logger(logger),
http.Context(ctx),
http.Config(scfg),
http.Metrics(m),
)
if err != nil {
logger.Info().
Err(err).
Str("transport", "http").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.Run()
}, func(_ error) {
logger.Info().
Str("transport", "http").
Msg("Shutting down server")
cancel()
})
}
return nil
}
func configureWebDAV(cfg *config.Config) *svcconfig.Config {
cfg.WebDAV.Log.Level = cfg.Log.Level
cfg.WebDAV.Log.Pretty = cfg.Log.Pretty
@@ -82,5 +40,4 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config {
func init() {
register.AddCommand(WebDAVCommand)
register.AddHandler(WebDAVHandler)
}