Integreate konnectd library #8

This commit is contained in:
Ilja Neumann
2020-01-28 16:19:32 +01:00
parent 046fec2033
commit 89af83ea46
55 changed files with 798 additions and 45 deletions
+12
View File
@@ -1,16 +1,26 @@
package http
import (
"crypto/tls"
svc "github.com/owncloud/ocis-konnectd/pkg/service/v0"
"github.com/owncloud/ocis-konnectd/pkg/version"
"github.com/owncloud/ocis-pkg/middleware"
"github.com/owncloud/ocis-pkg/service/http"
"os"
)
// Server initializes the http service and server.
func Server(opts ...Option) (http.Service, error) {
options := newOptions(opts...)
cer, err := tls.LoadX509KeyPair(options.Config.HTTP.TLSCert, options.Config.HTTP.TLSKey)
if err != nil {
options.Logger.Fatal().Err(err).Msg("Could not setup TLS")
os.Exit(1)
}
config := &tls.Config{Certificates: []tls.Certificate{cer}}
service := http.NewService(
http.Logger(options.Logger),
http.Namespace(options.Config.HTTP.Namespace),
@@ -19,8 +29,10 @@ func Server(opts ...Option) (http.Service, error) {
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
http.Flags(options.Flags...),
http.TLSConfig(config),
)
options.Config.Konnectd.Listen = options.Config.HTTP.Addr
handle := svc.NewService(
svc.Logger(options.Logger),
svc.Config(options.Config),