allow space-separated list of signature keys

This is necessary when specifying options as environment variables.
Also add documentation for using multiple signature keys.
This commit is contained in:
Will Norris 2020-02-02 18:45:39 +00:00
parent dec2089f0b
commit edd9dbac2d
2 changed files with 16 additions and 11 deletions

View file

@ -109,17 +109,18 @@ func (skl *signatureKeyList) String() string {
}
func (skl *signatureKeyList) Set(value string) error {
key := []byte(value)
if strings.HasPrefix(value, "@") {
file := strings.TrimPrefix(value, "@")
var err error
key, err = ioutil.ReadFile(file)
if err != nil {
log.Fatalf("error reading signature file: %v", err)
for _, v := range strings.Fields(value) {
key := []byte(v)
if strings.HasPrefix(v, "@") {
file := strings.TrimPrefix(v, "@")
var err error
key, err = ioutil.ReadFile(file)
if err != nil {
log.Fatalf("error reading signature file: %v", err)
}
}
*skl = append(*skl, key)
}
*skl = append(*skl, key)
return nil
}