secret

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 27

Documentation

Overview

Package secret implements an agent to read and reload the secrets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSecrets

func LoadSecrets(paths []string) (map[string][]byte, error)

LoadSecrets loads multiple paths of secrets and add them in a map.

func LoadSingleSecret

func LoadSingleSecret(path string) ([]byte, error)

LoadSingleSecret reads and returns the value of a single file.

Types

type Agent

type Agent struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Agent watches a path and automatically loads the secrets stored.

func (*Agent) Add

func (a *Agent) Add(path string) error

Add registers a new path to the agent.

func (*Agent) Censor

func (a *Agent) Censor(content []byte) []byte

Censor replaces sensitive parts of the content with a placeholder.

func (*Agent) GetSecret

func (a *Agent) GetSecret(secretPath string) []byte

GetSecret returns the value of a secret stored in a map.

func (*Agent) GetTokenGenerator

func (a *Agent) GetTokenGenerator(secretPath string) func() []byte

GetTokenGenerator returns a function that gets the value of a given secret.

func (*Agent) Start

func (a *Agent) Start(paths []string) error

Start creates goroutines to monitor the files that contain the secret value. Additionally, Start wraps the current standard logger formatter with a censoring formatter that removes secret occurrences from the logs.

func (*Agent) Stop

func (a *Agent) Stop()

Jump to

Keyboard shortcuts

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