do not decode empty keys.yml (#456)

This commit is contained in:
Black Swan 2025-11-07 06:40:58 +02:00 committed by GitHub
parent 9244f60ca4
commit 1e61da5608
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,10 +73,17 @@ func NewFileKeyManager(
defer file.Close()
d := yaml.NewDecoder(file)
fileInfo, err := file.Stat()
if err := d.Decode(store); err != nil {
logger.Panic("could not decode store", zap.Error(err))
if err != nil {
logger.Panic("could not get key file info", zap.Error(err))
}
if fileInfo.Size() != 0 {
d := yaml.NewDecoder(file)
if err := d.Decode(store); err != nil {
logger.Panic("could not decode store", zap.Error(err))
}
}
keyManager := &FileKeyManager{