web: fix advertise address (#1608)

* web: fix advertise address
* web: fix test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
Co-authored-by: Asim Aslam <asim@aslam.me>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
gggwvg 2020-05-08 17:31:03 +08:00 committed by GitHub
parent f062013a7b
commit d61df6363b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ func (s *service) genSrv() *registry.Service {
// if it exists then use it, otherwise // if it exists then use it, otherwise
// use the address // use the address
if len(s.opts.Advertise) > 0 { if len(s.opts.Advertise) > 0 {
host, port, err = net.SplitHostPort(s.opts.Address) host, port, err = net.SplitHostPort(s.opts.Advertise)
if err != nil { if err != nil {
logger.Fatal(err) logger.Fatal(err)
} }

View File

@ -164,7 +164,7 @@ func TestOptions(t *testing.T) {
id = "service-id" id = "service-id"
version = "service-version" version = "service-version"
address = "service-addr:8080" address = "service-addr:8080"
advertise = "service-adv" advertise = "service-adv:8080"
reg = memory.NewRegistry() reg = memory.NewRegistry()
registerTTL = 123 * time.Second registerTTL = 123 * time.Second
registerInterval = 456 * time.Second registerInterval = 456 * time.Second