Skip to content

Commit

Permalink
define version at the root
Browse files Browse the repository at this point in the history
  • Loading branch information
raylas committed Nov 28, 2022
1 parent 2f4b11a commit bffbbd5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 0 additions & 6 deletions internal/util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ const (
BaseURL = "https://api.nextdns.io"
)

var version = "dev" // Set by goreleaser.

var (
Log hclog.Logger
Version string
Port string
MetricsPath string
Profile string
Expand All @@ -33,9 +30,6 @@ func init() {
Level: hclog.LevelFromString(level),
})

// Set version.
Version = version

// Retrieve configuration, or use defaults.
Port = fmt.Sprintf(":%s", DefaultEnv("METRICS_PORT", "9948"))
MetricsPath = DefaultEnv("METRICS_PATH", "/metrics")
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/raylas/nextdns-exporter/internal/util"
)

var version = "dev" // Set by goreleaser.

type exporter struct {
profile, apiKey string

Expand Down Expand Up @@ -235,7 +237,7 @@ func main() {
exporter := newExporter(util.Profile, util.APIKey)
prometheus.MustRegister(exporter)

util.Log.Info("starting exporter", "version", util.Version, "port", util.Port, "path", util.MetricsPath)
util.Log.Info("starting exporter", "version", version, "port", util.Port, "path", util.MetricsPath)
http.Handle(util.MetricsPath, promhttp.Handler())
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, util.MetricsPath, http.StatusMovedPermanently)
Expand Down

0 comments on commit bffbbd5

Please sign in to comment.