Skip to content
/ vaultapi Public
forked from shoenig/vaultapi

A Go vault client for the rest of us

License

Notifications You must be signed in to change notification settings

indjb/vaultapi

 
 

Repository files navigation

vaultapi

A Go vault client for the rest of us.

Go Report Card Build Status GoDoc License

About

vaultapi is a vault client library for Go programs, targeted at the "99% use case". What this means is that while an official Go client provided by Hashicorp exists and exposes the complete functionality of vault, it is often difficult to use and is extremely inconvenient to work with in test cases. This vault library for Go aims to be easily mockable while providing interfaces that are easy to work with.

Install

Like any Go library, just use go get to install. If the Go team ever officially blesses a package manager, this library will incorporate that.

go get github.com/shoenig/vaultapi

Usage

Creating a vault Client is very simple, just call New with the desired ClientOptions.

tracer := log.New(os.Stdout, "vaultapi-", log.LstdFlags)
options := vaultapi.ClientOptions{
    Servers: []string{"https://localhost:8200"},
    HTTPTimeout: 10 * time.Second, // default
    SkipTLSVerification: false, // default
    Logger: tracer,
}

tokener := vaultapi.NewStaticToken("abcdefgh-abcd-abcd-abcdefgh")
client, err := vaultapi.New(options, tokener)
// client implements the vaultapi.Client interface

leader, err := client.Leader()
// etc ...

About

A Go vault client for the rest of us

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.3%
  • Shell 4.7%