many improvements with options and noop stuff

* add many options helpers
* fix noop client to allow publish messages to topic in broker
* fix noop server to allow registering in registry
* fix noop server to allow subscribe to topic in broker
* fix new service initialization

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-10-16 09:38:57 +03:00
parent a59aae760f
commit 14c97d59c1
39 changed files with 1384 additions and 432 deletions

View File

@@ -21,13 +21,8 @@ type httpServer struct {
}
func NewServer(address string, opts ...server.Option) server.Server {
var options server.Options
for _, o := range opts {
o(&options)
}
return &httpServer{
opts: options,
opts: server.NewOptions(opts...),
mux: http.NewServeMux(),
address: address,
exit: make(chan chan error),

View File

@@ -21,6 +21,14 @@ type Options struct {
Wrappers []Wrapper
}
func NewOptions(opts ...Option) Options {
options := Options{}
for _, o := range opts {
o(&options)
}
return options
}
type Wrapper func(h http.Handler) http.Handler
func WrapHandler(w ...Wrapper) Option {