1. implemented filesystem storage, NATS object storage and saving to Vault. 2. Test coverage is fine for filesystem and Vault (and NATS object does not really require extensive tests)
19 lines
285 B
Go
19 lines
285 B
Go
package storageutil
|
|
|
|
import "github.com/hashicorp/vault/api"
|
|
|
|
func NewVaultApiClient(token string, addr string) (*api.Client, error) {
|
|
conf := &api.Config{
|
|
Address: addr,
|
|
}
|
|
|
|
c, err := api.NewClient(conf)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
c.SetToken(token)
|
|
|
|
return c, nil
|
|
}
|