Delay salt initialization for audit backends

This commit is contained in:
Jeff Mitchell
2017-05-23 20:36:20 -04:00
parent 41d4c69b54
commit dd26071875
18 changed files with 382 additions and 105 deletions

View File

@@ -4,12 +4,15 @@ import (
"encoding/json"
"fmt"
"io"
"github.com/hashicorp/vault/helper/salt"
)
// JSONFormatWriter is an AuditFormatWriter implementation that structures data into
// a JSON format.
type JSONFormatWriter struct {
Prefix string
Prefix string
SaltFunc func() (*salt.Salt, error)
}
func (f *JSONFormatWriter) WriteRequest(w io.Writer, req *AuditRequestEntry) error {
@@ -43,3 +46,7 @@ func (f *JSONFormatWriter) WriteResponse(w io.Writer, resp *AuditResponseEntry)
enc := json.NewEncoder(w)
return enc.Encode(resp)
}
func (f *JSONFormatWriter) Salt() (*salt.Salt, error) {
return f.SaltFunc()
}