diff --git a/config/configuration.go b/config/configuration.go index 7c03318..5f75dbd 100644 --- a/config/configuration.go +++ b/config/configuration.go @@ -78,7 +78,11 @@ func (c *Config) String() string { for i := 0; i < fields.NumField(); i++ { valueField := fields.Field(i) typeField := fields.Type().Field(i) - buffer[i] = fmt.Sprintf("%s=%v", typeField.Name, valueField.Interface()) + if typeField.Name != "PIHolePassword" && typeField.Name != "PIHoleApiToken" { + buffer[i] = fmt.Sprintf("%s=%v", typeField.Name, valueField.Interface()) + } else if valueField.Len() > 0 { + buffer[i] = fmt.Sprintf("%s=%s", typeField.Name, "*****") + } } return fmt.Sprintf("", &c, strings.Join(buffer, ", ")) diff --git a/internal/pihole/client.go b/internal/pihole/client.go index c46bd53..5bb97c6 100644 --- a/internal/pihole/client.go +++ b/internal/pihole/client.go @@ -31,7 +31,7 @@ func NewClient(config *config.Config) *Client { os.Exit(1) } - fmt.Printf("Creating client with config %s\n", config) + log.Printf("Creating client with config %s\n", config) return &Client{ config: config, diff --git a/main.go b/main.go index 8bee1a8..1adb3de 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "log" "github.com/eko/pihole-exporter/config" @@ -41,7 +40,7 @@ func main() { case <-serverDead: } - fmt.Println("pihole-exporter HTTP server stopped") + log.Println("pihole-exporter HTTP server stopped") } func buildClients(clientConfigs []config.Config) []*pihole.Client {