Skip to content
Docs
Modules
vault

vault

ℹ️

This module requires that Risor has been compiled with the vault Go build tag. When compiling manually, make sure you specify -tags vault (opens in a new tab).

Module vault provides a client to interact with Hashicorp Vault

Functions

connect

Function signature
connect(address string)

Instanciates a new client for the given Vault address

Example
client := vault.connect("http://127.0.0.1:8200")
client.token = "hvs.AJ71UUKBsv1jiW7pJljTz4BN"

write

Function signature
write(data object, path string)

Writes the given object to the given path.

Example
client.write({"data": {"password1": "t0p$ecret", "password2": "cl@$$ified"}}, "/secret/data/foo")

write_raw

Function signature
write_raw(data byte_slice, path string)

Writes the given data to the given path.

Example
client.write_raw(byte_slice('{"data": {"password1": "t0p$ecret", "password2": "cl@$$ified"}}'), "/secret/data/foo")

read

Function signature
read(path string) object

Returns an object from the given path

Example
client.read("/secret/data/foo")

read_raw

Function signature
read_raw(path string) object

Returns an HTTP response object from Vault from the given path

Example
client.read("/secret/data/foo")

delete

Function signature
delete(path string) object

Deletes an object from the given path

Example
client.delete("/secret/data/foo")

list

Function signature
list(path string) object

Returns a list objects from the given path

Example
client.list("/secret/data/foo")