secrets

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package secrets provides functions for retrieving local and remote secrets and interpolating them into configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interpolate

func Interpolate(ctx context.Context, s string) (string, error)

Interpolate identifies when a string contains one or more secrets and interpolates each secret with the string. This function uses the same convention as the standard library's regexp package for capturing named groups (${name}).

For example, if the string is "/path/to/${SECRET:FOO}" and BAR is the secret value stored in the internal lookup, then the interpolated string is "/path/to/BAR".

Multiple secrets can be stored in a single string; if the string is "/path/to/${SECRET:FOO}/${SECRET:BAZ}", then the interpolated string is "/path/to/BAR/QUX".

If more than one interpolation function is applied to a string (e.g., non-secrets capture groups), then this function must be called first.

Types

type Retriever added in v1.0.0

type Retriever interface {
	Retrieve(context.Context) error
	Expired() bool
}

func New added in v1.0.0

func New(ctx context.Context, cfg config.Config) (Retriever, error)

Jump to

Keyboard shortcuts

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