mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Support for --passphrase & --passphrase-file arguments on publishing. #94
This commit is contained in:
+17
-2
@@ -17,6 +17,7 @@ type Signer interface {
|
||||
Init() error
|
||||
SetKey(keyRef string)
|
||||
SetKeyRing(keyring, secretKeyring string)
|
||||
SetPassphrase(passphrase, passphraseFile string)
|
||||
DetachedSign(source string, destination string) error
|
||||
ClearSign(source string, destination string) error
|
||||
}
|
||||
@@ -38,8 +39,9 @@ var (
|
||||
|
||||
// GpgSigner is implementation of Signer interface using gpg
|
||||
type GpgSigner struct {
|
||||
keyRef string
|
||||
keyring, secretKeyring string
|
||||
keyRef string
|
||||
keyring, secretKeyring string
|
||||
passphrase, passphraseFile string
|
||||
}
|
||||
|
||||
// SetKey sets key ID to use when signing files
|
||||
@@ -52,6 +54,11 @@ func (g *GpgSigner) SetKeyRing(keyring, secretKeyring string) {
|
||||
g.keyring, g.secretKeyring = keyring, secretKeyring
|
||||
}
|
||||
|
||||
// SetPassphrase sets passhprase params
|
||||
func (g *GpgSigner) SetPassphrase(passphrase, passphraseFile string) {
|
||||
g.passphrase, g.passphraseFile = passphrase, passphraseFile
|
||||
}
|
||||
|
||||
func (g *GpgSigner) gpgArgs() []string {
|
||||
args := []string{}
|
||||
if g.keyring != "" {
|
||||
@@ -65,6 +72,14 @@ func (g *GpgSigner) gpgArgs() []string {
|
||||
args = append(args, "-u", g.keyRef)
|
||||
}
|
||||
|
||||
if g.passphrase != "" {
|
||||
args = append(args, "--passphrase", g.passphrase)
|
||||
}
|
||||
|
||||
if g.passphraseFile != "" {
|
||||
args = append(args, "--passphrase-file", g.passphraseFile)
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user