adding some logging to the unlocker service.

This commit is contained in:
greg stone
2023-02-27 18:53:04 +00:00
parent cd741dd07a
commit c5bb21e4d8
2 changed files with 35 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package storage
import (
"context"
"github.com/dgraph-io/badger/v3"
"github.com/spf13/viper"
)
type Service struct {
@@ -19,15 +20,24 @@ func (s *Service) Unlock(ctx context.Context, req *UnlockRequest) (res *UnlockRe
key.Decode(req.Key)
opts = badger.DefaultOptions(viper.GetString(storeFilePathFlag))
opts.Logger = nil
opts.IndexCacheSize = 128 << 20
opts.EncryptionKey = key.Bytes()
if db, err = badger.Open(opts); check(err) {
if db, err = badger.Open(opts); err != nil {
log.I.Ln("unlock attempt failed:", err)
return &UnlockResponse{
Success: false,
}, err
}
s.success <- true
isUnlockedChan <- true
log.I.Ln("unlock successful")
return &UnlockResponse{
Success: true,