initial commit

This commit is contained in:
A.Unger
2021-02-18 08:00:02 +00:00
committed by Jörn Friedrich Dreyer
parent 530ee622db
commit 88f670b45c
3 changed files with 107 additions and 13 deletions
+14 -13
View File
@@ -5,12 +5,13 @@ import (
"strings"
"time"
"github.com/micro/go-micro/v2/web"
web "github.com/asim/go-micro/plugins/server/http/v3"
"github.com/asim/go-micro/v3/server"
)
// Service simply wraps the go-micro web service.
type Service struct {
web.Service
server.Server
}
// NewService initializes a new http service.
@@ -21,8 +22,8 @@ func NewService(opts ...Option) Service {
Str("addr", sopts.Address).
Msg("starting server")
wopts := []web.Option{
web.Name(
wopts := []server.Option{
server.Name(
strings.Join(
[]string{
sopts.Namespace,
@@ -31,18 +32,18 @@ func NewService(opts ...Option) Service {
".",
),
),
web.Version(sopts.Version),
web.Address(sopts.Address),
web.RegisterTTL(time.Second * 30),
web.RegisterInterval(time.Second * 10),
web.Context(sopts.Context),
web.TLSConfig(sopts.TLSConfig),
web.Handler(sopts.Handler),
web.Flags(sopts.Flags...),
server.Version(sopts.Version),
server.Address(sopts.Address),
server.RegisterTTL(time.Second * 30),
server.RegisterInterval(time.Second * 10),
server.Context(sopts.Context),
server.TLSConfig(sopts.TLSConfig),
//server.Handler(sopts.Handler),
//server.Flags(sopts.Flags...),
}
return Service{
web.NewService(
web.NewServer(
wopts...,
),
}