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

@@ -5,13 +5,15 @@ import (
"fmt"
"io"
"github.com/hashicorp/vault/helper/salt"
"github.com/jefferai/jsonx"
)
// JSONxFormatWriter is an AuditFormatWriter implementation that structures data into
// a XML format.
type JSONxFormatWriter struct {
Prefix string
Prefix string
SaltFunc func() (*salt.Salt, error)
}
func (f *JSONxFormatWriter) WriteRequest(w io.Writer, req *AuditRequestEntry) error {
@@ -65,3 +67,7 @@ func (f *JSONxFormatWriter) WriteResponse(w io.Writer, resp *AuditResponseEntry)
_, err = w.Write(xmlBytes)
return err
}
func (f *JSONxFormatWriter) Salt() (*salt.Salt, error) {
return f.SaltFunc()
}