Documentation
¶
Overview ¶
Package secrets provides a secret retrieval interface with implementations for environment variables, GCP Secret Manager, and AWS SSM Parameter Store.
Example (EnvSecretSource) ¶
package main
import (
"context"
"fmt"
"os"
"github.com/verygoodsoftwarenotvirus/platform/v2/secrets/env"
)
func main() {
os.Setenv("EXAMPLE_SECRET", "s3cret")
defer os.Unsetenv("EXAMPLE_SECRET")
source := env.NewEnvSecretSource()
defer source.Close()
secret, err := source.GetSecret(context.Background(), "EXAMPLE_SECRET")
if err != nil {
panic(err)
}
fmt.Println(secret)
}
Output: s3cret
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoopSecretSource ¶
type NoopSecretSource struct{}
NoopSecretSource returns empty string for all secrets.
type SecretSource ¶
type SecretSource interface {
GetSecret(ctx context.Context, name string) (string, error)
Close() error
}
SecretSource provides access to secrets.
func NewNoopSecretSource ¶
func NewNoopSecretSource() SecretSource
NewNoopSecretSource returns a SecretSource that returns empty strings.
Click to show internal directories.
Click to hide internal directories.