Skip to content

Commit

Permalink
chore: fix commit rebase damage
Browse files Browse the repository at this point in the history
  • Loading branch information
npdgm committed Dec 16, 2024
1 parent 9dbeae0 commit e34c3dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmd/x509-certificate-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func main() {
kubeExcludeLabels := stringArrayFlag{}
getopt.FlagLong(&kubeExcludeLabels, "exclude-label", 0, "removes the kube secrets with the given label (or label value if specified) from the watch list (applied after --include-label)")

var PasswordsFile string
getopt.FlagLong(&PasswordsFile, "passwords-file", 0, "path to a yaml file containing a list of passwords to try when opening a p12 file")
var PasswordsFile string
getopt.FlagLong(&PasswordsFile, "passwords-file", 0, "path to a yaml file containing a list of passwords to try when opening a p12 file")

getopt.Parse()

Expand Down Expand Up @@ -139,7 +139,7 @@ func main() {
KubeExcludeNamespaces: kubeExcludeNamespaces,
KubeIncludeLabels: kubeIncludeLabels,
KubeExcludeLabels: kubeExcludeLabels,
PasswordsFile: PasswordsFile,
PasswordsFile: PasswordsFile,
}

if getopt.Lookup("expose-labels").Seen() {
Expand Down
10 changes: 5 additions & 5 deletions internal/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/bmatcuk/doublestar/v4"
"github.com/prometheus/exporter-toolkit/web"
"gopkg.in/yaml.v2"
"k8s.io/client-go/kubernetes"
"gopkg.in/yaml.v2"
)

// Exporter : Configuration (from command-line)
Expand Down Expand Up @@ -52,7 +52,7 @@ type Exporter struct {
isDiscovery bool
secretsCache *cache.Cache
configMapsCache *cache.Cache
p12PasswordsFile string
PasswordsFile string
}

// ListenAndServe : Convenience function to start exporter
Expand Down Expand Up @@ -269,7 +269,7 @@ func (exporter *Exporter) collectMatchingPaths(pattern string, format certificat
}
} else {
if strings.HasSuffix(file.Name(), ".crt") ||
strings.HasSuffix(file.Name(), ".pem") ||
strings.HasSuffix(file.Name(), ".pem") ||
strings.HasSuffix(file.Name(), ".cert") {
format = certificateFormatPEM
} else {
Expand Down Expand Up @@ -354,13 +354,13 @@ func (exporter *Exporter) obtainP12Passwords(filename string) (string, error) {
if err = yaml.Unmarshal(passwordsFile, &config); err != nil {
return "", err
}

for _, p12 := range config.P12 {
if p12.Name == filename {
return p12.Password, nil
}
}

return "", errors.New("p12 password not found")
}

Expand Down

0 comments on commit e34c3dc

Please sign in to comment.