mirror of
				https://github.com/fluxcd/flux2.git
				synced 2025-11-01 01:25:53 +08:00 
			
		
		
		
	Remove file reading from bootstrap package
Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
		| @ -1,5 +1,9 @@ | ||||
| package git | ||||
|  | ||||
| import ( | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| ) | ||||
|  | ||||
| // Option is a some configuration that modifies options for a commit. | ||||
| type Option interface { | ||||
| 	// ApplyToCommit applies this configuration to a given commit option. | ||||
| @ -13,9 +17,9 @@ type CommitOptions struct { | ||||
|  | ||||
| // GPGSigningInfo contains information for signing a commit. | ||||
| type GPGSigningInfo struct { | ||||
| 	KeyRingPath string | ||||
| 	Passphrase  string | ||||
| 	KeyID       string | ||||
| 	KeyRing    openpgp.EntityList | ||||
| 	Passphrase string | ||||
| 	KeyID      string | ||||
| } | ||||
|  | ||||
| type GpgSigningOption struct { | ||||
| @ -26,17 +30,17 @@ func (w GpgSigningOption) ApplyToCommit(in *CommitOptions) { | ||||
| 	in.GPGSigningInfo = w.GPGSigningInfo | ||||
| } | ||||
|  | ||||
| func WithGpgSigningOption(path, passphrase, keyID string) Option { | ||||
| func WithGpgSigningOption(keyRing openpgp.EntityList, passphrase, keyID string) Option { | ||||
| 	// Return nil if no path is set, even if other options are configured. | ||||
| 	if path == "" { | ||||
| 	if len(keyRing) == 0 { | ||||
| 		return GpgSigningOption{} | ||||
| 	} | ||||
|  | ||||
| 	return GpgSigningOption{ | ||||
| 		GPGSigningInfo: &GPGSigningInfo{ | ||||
| 			KeyRingPath: path, | ||||
| 			Passphrase:  passphrase, | ||||
| 			KeyID:       keyID, | ||||
| 			KeyRing:    keyRing, | ||||
| 			Passphrase: passphrase, | ||||
| 			KeyID:      keyID, | ||||
| 		}, | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Philip Laine
					Philip Laine