secrets

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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/v3/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