Integreate konnectd library #8
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user