Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed print of token/password in logs #109

Merged
merged 4 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ 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, "*****")
}
}
Galorhallen marked this conversation as resolved.
Show resolved Hide resolved
}

return fmt.Sprintf("<Config@%X %s>", &c, strings.Join(buffer, ", "))
Expand Down
16 changes: 0 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,3 @@ require (
github.com/xonvanetta/shutdown v0.0.3
golang.org/x/net v0.0.0-20200625001655-4c5254603344
)

Galorhallen marked this conversation as resolved.
Show resolved Hide resolved
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
2 changes: 1 addition & 1 deletion internal/pihole/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"log"

"github.com/eko/pihole-exporter/config"
Expand Down Expand Up @@ -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 {
Expand Down