Merge pull request #109 from Galorhallen/master

Removed print of token/password in logs
This commit is contained in:
Vincent Composieux 2022-01-07 23:06:34 +01:00 committed by GitHub
commit ca60f3a55e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -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("<Config@%X %s>", &c, strings.Join(buffer, ", "))

View File

@ -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,

View File

@ -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 {