secretmanager

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const SectionKey = "secrets"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SecretFilePrefix  string `json:"secrets-prefix" pflag:", Prefix where to look for secrets file"`
	EnvironmentPrefix string `json:"env-prefix" pflag:", Prefix for environment variables"`
}

func GetConfig

func GetConfig() *Config

func (Config) GetPFlagSet

func (cfg Config) GetPFlagSet(prefix string) *pflag.FlagSet

GetPFlagSet will return strongly types pflags for all fields in Config and its nested types. The format of the flags is json-name.json-sub-name... etc.

type FileEnvSecretManager

type FileEnvSecretManager struct {
	// contains filtered or unexported fields
}

FileEnvSecretManager allows retrieving secrets mounted to this process through Env Vars or Files.

func NewFileEnvSecretManager

func NewFileEnvSecretManager(cfg *Config) FileEnvSecretManager

func (FileEnvSecretManager) Get

func (FileEnvSecretManager) GetForSecret

func (f FileEnvSecretManager) GetForSecret(ctx context.Context, secret *coreIdl.Secret) (string, error)

GetForSecret retrieves a secret from the environment of the running process. To lookup secret, both secret's key and group must be non-empty. GetForSecret will first lookup env variables using the configured Prefix+SecretGroup+_+SecretKey. If the secret is not found in environment, it'll lookup the secret from files using the configured SecretPath / SecretGroup / SecretKey.

Jump to

Keyboard shortcuts

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