mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
Code review fixes - seeding random number generator and handling error with setting header
This commit is contained in:
parent
1223d49a62
commit
1f5bfa181b
1 changed files with 8 additions and 1 deletions
|
@ -54,6 +54,10 @@ var vaultRegex = regexp.MustCompile(vaultEncryptStart + "(.*)" + vaultEncryptEnd
|
||||||
|
|
||||||
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rand.Seed(time.Now().UTC().UnixNano())
|
||||||
|
}
|
||||||
|
|
||||||
// NewReaperDecryptor returns a Decryptor implementation that will call out to
|
// NewReaperDecryptor returns a Decryptor implementation that will call out to
|
||||||
// the reaper service to decrypt any encrypted arguments.
|
// the reaper service to decrypt any encrypted arguments.
|
||||||
func NewReaperDecryptor(url, signingKey, commandExecutorID string) Decryptor {
|
func NewReaperDecryptor(url, signingKey, commandExecutorID string) Decryptor {
|
||||||
|
@ -96,7 +100,10 @@ func (r *ReaperDecryptor) DecryptArguments(args []string) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cl := defaultClientWithRetries()
|
cl := defaultClientWithRetries()
|
||||||
addJWTHeader(retryReq, r.SigningKey)
|
err = addJWTHeader(retryReq, r.SigningKey)
|
||||||
|
if err != nil {
|
||||||
|
return args, fmt.Errorf("error signing request: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := cl.Do(retryReq)
|
resp, err := cl.Do(retryReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue