Replace proxy options
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
|
||||
"github.com/micro/go-micro/config/options"
|
||||
"github.com/micro/go-micro/errors"
|
||||
"github.com/micro/go-micro/proxy"
|
||||
"github.com/micro/go-micro/server"
|
||||
@@ -18,7 +17,7 @@ import (
|
||||
|
||||
// Proxy will proxy rpc requests as http POST requests. It is a server.Proxy
|
||||
type Proxy struct {
|
||||
options.Options
|
||||
options proxy.Options
|
||||
|
||||
// The http backend to call
|
||||
Endpoint string
|
||||
@@ -197,16 +196,15 @@ func NewSingleHostProxy(url string) proxy.Proxy {
|
||||
}
|
||||
|
||||
// NewProxy returns a new proxy which will route using a http client
|
||||
func NewProxy(opts ...options.Option) proxy.Proxy {
|
||||
p := new(Proxy)
|
||||
p.Options = options.NewOptions(opts...)
|
||||
p.Options.Init(options.WithString("http"))
|
||||
|
||||
// get endpoint
|
||||
ep, ok := p.Options.Values().Get("proxy.endpoint")
|
||||
if ok {
|
||||
p.Endpoint = ep.(string)
|
||||
func NewProxy(opts ...proxy.Option) proxy.Proxy {
|
||||
var options proxy.Options
|
||||
for _, o := range opts {
|
||||
o(&options)
|
||||
}
|
||||
|
||||
p := new(Proxy)
|
||||
p.Endpoint = options.Endpoint
|
||||
p.options = options
|
||||
|
||||
return p
|
||||
}
|
||||
|
Reference in New Issue
Block a user