Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ce9064fbb | |||
| 75f7a75379 |
@@ -27,16 +27,20 @@ type Service struct {
|
||||
|
||||
var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
|
||||
|
||||
func NewService(servAddr, id, name, hostname, domain, pathPrefix string, appPort int) (*Service, error) {
|
||||
func NewService(servAddr, id, name, useDomainOverIp, addr, domain, pathPrefix string, appPort int) (*Service, error) {
|
||||
s := new(Service)
|
||||
s.Name = name
|
||||
s.Address = hostname
|
||||
s.Address = addr
|
||||
s.appID = id
|
||||
s.domain = domain
|
||||
s.pathPrefix = pathPrefix
|
||||
s.port = appPort
|
||||
s.ttl = time.Second * 10
|
||||
|
||||
if useDomainOverIp == "true" { // FIXME types...
|
||||
s.Address = domain
|
||||
}
|
||||
|
||||
client, err := consul.NewClient(newClientConfig(servAddr))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -66,7 +70,7 @@ func (s *Service) GetFullAddr() string {
|
||||
if isTLS {
|
||||
proto = "https"
|
||||
}
|
||||
return fmt.Sprintf("%s://%s:%d/", proto, s.domain, s.port)
|
||||
return fmt.Sprintf("%s://%s:%d/", proto, s.Address, s.port)
|
||||
}
|
||||
|
||||
func (s *Service) Register() error {
|
||||
|
||||
Reference in New Issue
Block a user