Documentation
¶
Overview ¶
Package env provides a vault implementation that reads secrets from environment variables.
Usage:
v := env.New()
secret, err := v.Get(ctx, "API_KEY") // reads os.Getenv("API_KEY")
This provider is read-only by default. Writing to environment variables is possible but only affects the current process.
Index ¶
- type Config
- type Provider
- func (p *Provider) Capabilities() vault.Capabilities
- func (p *Provider) Close() error
- func (p *Provider) Delete(ctx context.Context, path string) error
- func (p *Provider) Exists(ctx context.Context, path string) (bool, error)
- func (p *Provider) Get(ctx context.Context, path string) (*vault.Secret, error)
- func (p *Provider) List(ctx context.Context, prefix string) ([]string, error)
- func (p *Provider) Name() string
- func (p *Provider) Set(ctx context.Context, path string, secret *vault.Secret) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Prefix is an optional prefix to add to all variable names.
// For example, if Prefix is "MYAPP_", Get("API_KEY") will read "MYAPP_API_KEY".
Prefix string
// AllowWrite enables writing to environment variables.
// Note: This only affects the current process.
AllowWrite bool
}
Config holds configuration for the environment variable provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements vault.Vault for environment variables.
func NewWithConfig ¶
NewWithConfig creates a new environment variable provider with configuration.
func (*Provider) Capabilities ¶
func (p *Provider) Capabilities() vault.Capabilities
Capabilities returns the provider capabilities.
Click to show internal directories.
Click to hide internal directories.