secrets

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

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.

func (*NoopSecretSource) Close

func (n *NoopSecretSource) Close() error

Close is a no-op.

func (*NoopSecretSource) GetSecret

func (n *NoopSecretSource) GetSecret(ctx context.Context, name string) (string, error)

GetSecret returns empty string.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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