vault

package
v1.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

Vault Source

The vault source reads config from different secret engines in a Vault server. For example:

kv: secret/data/<my/secret>
database credentials: database/creds/<my-db-role>

New Source

Specify source with data

vaultSource := vault.NewSource(
	// mandatory: it specifies server address. 
	// It could have different formats:
	// 127.0.0.1 -> https://127.0.0.1:8200
	// http://127.0.0.1 -> http://127.0.0.1:8200
	// http://127.0.0.1:2233
	vault.WithAddress("http://127.0.0.1:8200"),
	// mandatory: it specifies a resource to been access
	vault.WithResourcePath("secret/data/my/secret"),
    // mandatory: it specifies a resource to been access
	vault.WithToken("<my-token>"),
	// optional: path to store my secret.
	// By default use resourcePath value 
	vault.WithSecretName("my/secret"),
	// optional: namespace.
    vault.WithNameSpace("myNameSpace"),
)

Load Source

Load the source into config

// Create new config
conf := config.NewConfig()

// Load file source
conf.Load(vaultSource)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSource

func NewSource(opts ...source.Option) source.Source

NewSource creates a new vault source

func WithAddress

func WithAddress(a string) source.Option

WithAddress sets the server address

func WithNameSpace

func WithNameSpace(n string) source.Option

WithNameSpace sets the namespace that its going to be access

func WithResourcePath

func WithResourcePath(p string) source.Option

WithResourcePath sets the resource that will be access

func WithSecretName

func WithSecretName(t string) source.Option

WithSecretName sets the name of the secret to wrap in on a map

func WithToken

func WithToken(t string) source.Option

WithToken sets the key token to use

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL