libvault/test/test.go

44 lines
904 B
Go

//////////////////////////////////////////////////////////////////////////
package main
//////////////////////////////////////////////////////////////////////////
import (
"crypto/tls"
"fmt"
log "github.com/sirupsen/logrus"
vault "libvault"
)
//////////////////////////////////////////////////////////////////////////
// everything starts here
func main() {
log.SetLevel(log.DebugLevel)
token, _ := vault.NewTokenFromFile("/home/simon/.vault-token")
config := &tls.Config{}
tlsreq := &vault.TLSRequest{
CommonName: "here.burble.dn42",
AltNames: "there.burble.dn42,everywhere.burble.dn42",
}
{
ok, err := tlsreq.Renew(token, config)
fmt.Printf("ok: %v, err: %v\n", ok, err)
}
// and again
{
ok, err := tlsreq.Renew(token, config)
fmt.Printf("ok: %v, err: %v\n", ok, err)
}
}
//////////////////////////////////////////////////////////////////////////
// end of code