Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
tetafro committed Sep 8, 2023
1 parent f1d06eb commit fbe3c99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func main() {
configFile := flag.String("config", "./config.yml", "path to config file")
flag.Parse()

config, err := ReadConfig(*configFile)
conf, err := ReadConfig(*configFile)
if err != nil {
log.Fatalf("Failed to read config: %v", err)
}

// Create a client for each target
targets := map[string]*ConnectBox{}
for _, t := range config.Targets {
for _, t := range conf.Targets {
client, err := NewConnectBox(
t.Addr,
t.Username,
Expand All @@ -56,13 +56,13 @@ func main() {
mux.Handle("/probe", collector)
//nolint:gosec
srv := http.Server{
Addr: config.ListenAddr,
Addr: conf.ListenAddr,
Handler: mux,
}

// Run HTTP server
go func() {
log.Printf("Listening on %s...", config.ListenAddr)
log.Printf("Listening on %s...", conf.ListenAddr)
err := srv.ListenAndServe()
if err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Printf("HTTP server error: %v", err)
Expand Down

0 comments on commit fbe3c99

Please sign in to comment.