Skip to content

Commit

Permalink
Fall back to agent address if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Apr 26, 2020
1 parent 9733814 commit 578a958
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions discovery/consul.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package discovery

import "github.com/martin-helmich/prometheus-nginxlog-exporter/config"
import "github.com/hashicorp/consul/api"
import (
"github.com/hashicorp/consul/api"
"github.com/martin-helmich/prometheus-nginxlog-exporter/config"
)

// ConsulRegistrator is a helper struct that handles Consul service registration
type ConsulRegistrator struct {
Expand Down Expand Up @@ -45,7 +47,7 @@ func NewConsulRegistrator(cfg *config.Config) (*ConsulRegistrator, error) {
func (r *ConsulRegistrator) RegisterConsul() error {
registration := api.AgentServiceRegistration{
ID: r.serviceID,
Address: getDefault(r.config.Consul.Service.Address, r.config.Listen.Address),
Address: r.config.Consul.Service.Address,
Port: r.config.Listen.Port,
Name: getDefault(r.config.Consul.Service.Name, "nginx-exporter"),
Tags: r.config.Consul.Service.Tags,
Expand Down

0 comments on commit 578a958

Please sign in to comment.