Skip to content

nemre/havault-light

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

havault-light

Lightest HashiCorp Vault Go Client Library

Usage

package main

import (
    "context"

    "github.com/nemre/havault-light"
)

func main() {
    ctx := context.TODO()

    vault, err := havaultlight.New(ctx, &havaultlight.Config{
        Addr: "http://localhost:8200",
        Engine: "secret",
        Token: "foo",
    })
    if err != nil {
        panic(err)
    }

    if err = vault.Ping(ctx); err != nil {
        panic(err)
    }

    if err = vault.Set(ctx, "foo", map[string]any{"a": "b"}); err != nil {
        panic(err)
    }

    foo, err := vault.Get(ctx, "foo")
    if err != nil {
        panic(err)
    }

    println(foo["a"])

    if err = vault.Delete(ctx, "foo"); err != nil {
        panic(err)
    }
}

About

Lightest HashiCorp Vault Go Client Library

Topics

Resources

License

Stars

Watchers

Forks

Languages