Skip to content

Commit

Permalink
Fix: Remove Batch from API options, set to true by default, add comments
Browse files Browse the repository at this point in the history
Fixes: #1106
  • Loading branch information
reglim committed Aug 18, 2023
1 parent 847fd90 commit 519747a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions api/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
// SigningOptions is a shared between publish API GPG options structure
type SigningOptions struct {
Skip bool
Batch bool
GpgKey string
Keyring string
SecretKeyring string
Expand All @@ -33,7 +32,9 @@ func getSigner(options *SigningOptions) (pgp.Signer, error) {
signer.SetKey(options.GpgKey)
signer.SetKeyRing(options.Keyring, options.SecretKeyring)
signer.SetPassphrase(options.Passphrase, options.PassphraseFile)
signer.SetBatch(options.Batch)

// If Batch is false, GPG will ask for passphrase on stdin, which would block the api process
signer.SetBatch(true)

err := signer.Init()
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pgp/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ type GoSigner struct {
signerConfig *packet.Config
}

// SetBatch controls whether we allowed to interact with user
// SetBatch controls whether we allowed to interact with user, for example
// for getting the passphrase from stdin.
func (g *GoSigner) SetBatch(batch bool) {
g.batch = batch
}
Expand Down

0 comments on commit 519747a

Please sign in to comment.