summaryrefslogtreecommitdiff
path: root/store/secret.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/secret.go')
-rw-r--r--store/secret.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/store/secret.go b/store/secret.go
index c17443a..5941c2f 100644
--- a/store/secret.go
+++ b/store/secret.go
@@ -2,7 +2,7 @@ package store
import (
"crypto/rand"
- log "github.com/sirupsen/logrus"
+ "fmt"
"math/big"
"os"
)
@@ -12,8 +12,7 @@ func (s *Store) SecretNew() string {
secret := make([]byte, 64)
for i := 0; i < 64; i++ {
if n, err := rand.Int(rand.Reader, big.NewInt(int64(len(letters)))); err != nil {
- log.Fatalf("Error while generating secret, %s", err)
- log.Exit(1)
+ s.fatalClose(fmt.Sprintf("Error generating secret, %s", err))
} else {
secret[i] = letters[n.Int64()]
}
@@ -30,8 +29,7 @@ func (s *Store) SecretLookup(secret string) User {
return s.user(s.SecretPath(secret) + "/" + infoJson)
} else {
if path, err := os.ReadFile(s.SecretPath(secret)); err != nil {
- log.Fatalf("Error reading association file of secret %s, %s", secret, err)
- os.Exit(1)
+ s.fatalClose(fmt.Sprintf("Error reading association file of secret %s, %s", secret, err))
} else {
return s.user(string(path) + "/" + infoJson)
}
@@ -53,7 +51,6 @@ func (s *Store) SecretDisassociate(secret string) {
return
}
if err := os.Remove(s.SecretPath(secret)); err != nil {
- log.Fatalf("Error disassociating secret %s, %s", secret, err)
- os.Exit(1)
+ s.fatalClose(fmt.Sprintf("Error disassociating secret %s, %s", secret, err))
}
}