- #309 adding gpgKeys config key, accepting array of keyRef, cli args has precedence

- #691 adding handling of multiple keyRefs when signing with gpg
This commit is contained in:
Ales Bregar
2025-08-11 10:34:15 +02:00
committed by André Roth
parent 7d23196f76
commit 9a90038dd2
8 changed files with 57 additions and 12 deletions
+8 -4
View File
@@ -22,7 +22,7 @@ var (
type GpgSigner struct {
gpg string
version GPGVersion
keyRef string
keyRefs []string
keyring, secretKeyring string
passphrase, passphraseFile string
batch bool
@@ -35,7 +35,11 @@ func (g *GpgSigner) SetBatch(batch bool) {
// SetKey sets key ID to use when signing files
func (g *GpgSigner) SetKey(keyRef string) {
g.keyRef = keyRef
if g.keyRefs == nil {
g.keyRefs = []string{strings.TrimSpace(keyRef)}
} else {
g.keyRefs = append(g.keyRefs, strings.TrimSpace(keyRef))
}
}
// SetKeyRing allows to set custom keyring and secretkeyring
@@ -57,8 +61,8 @@ func (g *GpgSigner) gpgArgs() []string {
args = append(args, "--secret-keyring", g.secretKeyring)
}
if g.keyRef != "" {
args = append(args, "-u", g.keyRef)
for _, k := range g.keyRefs {
args = append(args, "-u", k)
}
if g.passphrase != "" || g.passphraseFile != "" {